binder: Use wake up hint for synchronous transactions.
[linux-2.6/btrfs-unstable.git] / include / linux / oom.h
blob8a266e2be5a63a29a2de38ff76f0bdc2e4fac08e
1 #ifndef __INCLUDE_LINUX_OOM_H
2 #define __INCLUDE_LINUX_OOM_H
5 #include <linux/sched/signal.h>
6 #include <linux/types.h>
7 #include <linux/nodemask.h>
8 #include <uapi/linux/oom.h>
10 struct zonelist;
11 struct notifier_block;
12 struct mem_cgroup;
13 struct task_struct;
16 * Details of the page allocation that triggered the oom killer that are used to
17 * determine what should be killed.
19 struct oom_control {
20 /* Used to determine cpuset */
21 struct zonelist *zonelist;
23 /* Used to determine mempolicy */
24 nodemask_t *nodemask;
26 /* Memory cgroup in which oom is invoked, or NULL for global oom */
27 struct mem_cgroup *memcg;
29 /* Used to determine cpuset and node locality requirement */
30 const gfp_t gfp_mask;
33 * order == -1 means the oom kill is required by sysrq, otherwise only
34 * for display purposes.
36 const int order;
38 /* Used by oom implementation, do not set */
39 unsigned long totalpages;
40 struct task_struct *chosen;
41 unsigned long chosen_points;
44 extern struct mutex oom_lock;
46 static inline void set_current_oom_origin(void)
48 current->signal->oom_flag_origin = true;
51 static inline void clear_current_oom_origin(void)
53 current->signal->oom_flag_origin = false;
56 static inline bool oom_task_origin(const struct task_struct *p)
58 return p->signal->oom_flag_origin;
61 static inline bool tsk_is_oom_victim(struct task_struct * tsk)
63 return tsk->signal->oom_mm;
66 extern unsigned long oom_badness(struct task_struct *p,
67 struct mem_cgroup *memcg, const nodemask_t *nodemask,
68 unsigned long totalpages);
70 extern bool out_of_memory(struct oom_control *oc);
72 extern void exit_oom_victim(void);
74 extern int register_oom_notifier(struct notifier_block *nb);
75 extern int unregister_oom_notifier(struct notifier_block *nb);
77 extern bool oom_killer_disable(signed long timeout);
78 extern void oom_killer_enable(void);
80 extern struct task_struct *find_lock_task_mm(struct task_struct *p);
82 /* sysctls */
83 extern int sysctl_oom_dump_tasks;
84 extern int sysctl_oom_kill_allocating_task;
85 extern int sysctl_panic_on_oom;
86 #endif /* _INCLUDE_LINUX_OOM_H */