oom: move badness() declaration into oom.h
[pandora-kernel.git] / include / linux / oom.h
1 #ifndef __INCLUDE_LINUX_OOM_H
2 #define __INCLUDE_LINUX_OOM_H
3
4 /* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
5 #define OOM_DISABLE (-17)
6 /* inclusive */
7 #define OOM_ADJUST_MIN (-16)
8 #define OOM_ADJUST_MAX 15
9
10 #ifdef __KERNEL__
11
12 #include <linux/types.h>
13 #include <linux/nodemask.h>
14
15 struct zonelist;
16 struct notifier_block;
17 struct mem_cgroup;
18 struct task_struct;
19
20 /*
21  * Types of limitations to the nodes from which allocations may occur
22  */
23 enum oom_constraint {
24         CONSTRAINT_NONE,
25         CONSTRAINT_CPUSET,
26         CONSTRAINT_MEMORY_POLICY,
27         CONSTRAINT_MEMCG,
28 };
29
30 extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
31 extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
32
33 extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
34                 int order, nodemask_t *mask);
35 extern int register_oom_notifier(struct notifier_block *nb);
36 extern int unregister_oom_notifier(struct notifier_block *nb);
37
38 extern bool oom_killer_disabled;
39
40 static inline void oom_killer_disable(void)
41 {
42         oom_killer_disabled = true;
43 }
44
45 static inline void oom_killer_enable(void)
46 {
47         oom_killer_disabled = false;
48 }
49
50 /* The badness from the OOM killer */
51 extern unsigned long badness(struct task_struct *p, struct mem_cgroup *mem,
52                       const nodemask_t *nodemask, unsigned long uptime);
53
54 /* sysctls */
55 extern int sysctl_oom_dump_tasks;
56 extern int sysctl_oom_kill_allocating_task;
57 extern int sysctl_panic_on_oom;
58 #endif /* __KERNEL__*/
59 #endif /* _INCLUDE_LINUX_OOM_H */