diff options
Diffstat (limited to 'include/linux/oom.h')
| -rw-r--r-- | include/linux/oom.h | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/include/linux/oom.h b/include/linux/oom.h index 537662315627..5e3aa8311c5e 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h | |||
| @@ -1,19 +1,34 @@ | |||
| 1 | #ifndef __INCLUDE_LINUX_OOM_H | 1 | #ifndef __INCLUDE_LINUX_OOM_H |
| 2 | #define __INCLUDE_LINUX_OOM_H | 2 | #define __INCLUDE_LINUX_OOM_H |
| 3 | 3 | ||
| 4 | /* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */ | 4 | /* |
| 5 | * /proc/<pid>/oom_adj is deprecated, see | ||
| 6 | * Documentation/feature-removal-schedule.txt. | ||
| 7 | * | ||
| 8 | * /proc/<pid>/oom_adj set to -17 protects from the oom-killer | ||
| 9 | */ | ||
| 5 | #define OOM_DISABLE (-17) | 10 | #define OOM_DISABLE (-17) |
| 6 | /* inclusive */ | 11 | /* inclusive */ |
| 7 | #define OOM_ADJUST_MIN (-16) | 12 | #define OOM_ADJUST_MIN (-16) |
| 8 | #define OOM_ADJUST_MAX 15 | 13 | #define OOM_ADJUST_MAX 15 |
| 9 | 14 | ||
| 15 | /* | ||
| 16 | * /proc/<pid>/oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for | ||
| 17 | * pid. | ||
| 18 | */ | ||
| 19 | #define OOM_SCORE_ADJ_MIN (-1000) | ||
| 20 | #define OOM_SCORE_ADJ_MAX 1000 | ||
| 21 | |||
| 10 | #ifdef __KERNEL__ | 22 | #ifdef __KERNEL__ |
| 11 | 23 | ||
| 24 | #include <linux/sched.h> | ||
| 12 | #include <linux/types.h> | 25 | #include <linux/types.h> |
| 13 | #include <linux/nodemask.h> | 26 | #include <linux/nodemask.h> |
| 14 | 27 | ||
| 15 | struct zonelist; | 28 | struct zonelist; |
| 16 | struct notifier_block; | 29 | struct notifier_block; |
| 30 | struct mem_cgroup; | ||
| 31 | struct task_struct; | ||
| 17 | 32 | ||
| 18 | /* | 33 | /* |
| 19 | * Types of limitations to the nodes from which allocations may occur | 34 | * Types of limitations to the nodes from which allocations may occur |
| @@ -22,9 +37,12 @@ enum oom_constraint { | |||
| 22 | CONSTRAINT_NONE, | 37 | CONSTRAINT_NONE, |
| 23 | CONSTRAINT_CPUSET, | 38 | CONSTRAINT_CPUSET, |
| 24 | CONSTRAINT_MEMORY_POLICY, | 39 | CONSTRAINT_MEMORY_POLICY, |
| 40 | CONSTRAINT_MEMCG, | ||
| 25 | }; | 41 | }; |
| 26 | 42 | ||
| 27 | extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags); | 43 | extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem, |
| 44 | const nodemask_t *nodemask, unsigned long totalpages); | ||
| 45 | extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); | ||
| 28 | extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); | 46 | extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); |
| 29 | 47 | ||
| 30 | extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, | 48 | extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, |
| @@ -43,5 +61,16 @@ static inline void oom_killer_enable(void) | |||
| 43 | { | 61 | { |
| 44 | oom_killer_disabled = false; | 62 | oom_killer_disabled = false; |
| 45 | } | 63 | } |
| 64 | |||
| 65 | /* The badness from the OOM killer */ | ||
| 66 | extern unsigned long badness(struct task_struct *p, struct mem_cgroup *mem, | ||
| 67 | const nodemask_t *nodemask, unsigned long uptime); | ||
| 68 | |||
| 69 | extern struct task_struct *find_lock_task_mm(struct task_struct *p); | ||
| 70 | |||
| 71 | /* sysctls */ | ||
| 72 | extern int sysctl_oom_dump_tasks; | ||
| 73 | extern int sysctl_oom_kill_allocating_task; | ||
| 74 | extern int sysctl_panic_on_oom; | ||
| 46 | #endif /* __KERNEL__*/ | 75 | #endif /* __KERNEL__*/ |
| 47 | #endif /* _INCLUDE_LINUX_OOM_H */ | 76 | #endif /* _INCLUDE_LINUX_OOM_H */ |
