]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - include/linux/oom.h
mtd: nand: atmel: Relax tADL_min constraint
[mirror_ubuntu-artful-kernel.git] / include / linux / oom.h
1 #ifndef __INCLUDE_LINUX_OOM_H
2 #define __INCLUDE_LINUX_OOM_H
3
4
5 #include <linux/sched/signal.h>
6 #include <linux/types.h>
7 #include <linux/nodemask.h>
8 #include <uapi/linux/oom.h>
9
10 struct zonelist;
11 struct notifier_block;
12 struct mem_cgroup;
13 struct task_struct;
14
15 /*
16 * Details of the page allocation that triggered the oom killer that are used to
17 * determine what should be killed.
18 */
19 struct oom_control {
20 /* Used to determine cpuset */
21 struct zonelist *zonelist;
22
23 /* Used to determine mempolicy */
24 nodemask_t *nodemask;
25
26 /* Memory cgroup in which oom is invoked, or NULL for global oom */
27 struct mem_cgroup *memcg;
28
29 /* Used to determine cpuset and node locality requirement */
30 const gfp_t gfp_mask;
31
32 /*
33 * order == -1 means the oom kill is required by sysrq, otherwise only
34 * for display purposes.
35 */
36 const int order;
37
38 /* Used by oom implementation, do not set */
39 unsigned long totalpages;
40 struct task_struct *chosen;
41 unsigned long chosen_points;
42 };
43
44 extern struct mutex oom_lock;
45
46 static inline void set_current_oom_origin(void)
47 {
48 current->signal->oom_flag_origin = true;
49 }
50
51 static inline void clear_current_oom_origin(void)
52 {
53 current->signal->oom_flag_origin = false;
54 }
55
56 static inline bool oom_task_origin(const struct task_struct *p)
57 {
58 return p->signal->oom_flag_origin;
59 }
60
61 static inline bool tsk_is_oom_victim(struct task_struct * tsk)
62 {
63 return tsk->signal->oom_mm;
64 }
65
66 extern unsigned long oom_badness(struct task_struct *p,
67 struct mem_cgroup *memcg, const nodemask_t *nodemask,
68 unsigned long totalpages);
69
70 extern bool out_of_memory(struct oom_control *oc);
71
72 extern void exit_oom_victim(void);
73
74 extern int register_oom_notifier(struct notifier_block *nb);
75 extern int unregister_oom_notifier(struct notifier_block *nb);
76
77 extern bool oom_killer_disable(signed long timeout);
78 extern void oom_killer_enable(void);
79
80 extern struct task_struct *find_lock_task_mm(struct task_struct *p);
81
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 */