diff options
Diffstat (limited to 'include/linux/oom.h')
-rw-r--r-- | include/linux/oom.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/include/linux/oom.h b/include/linux/oom.h index 922dab164eb0..da60007075b5 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h | |||
@@ -29,8 +29,23 @@ enum oom_scan_t { | |||
29 | OOM_SCAN_SELECT, /* always select this thread first */ | 29 | OOM_SCAN_SELECT, /* always select this thread first */ |
30 | }; | 30 | }; |
31 | 31 | ||
32 | extern void compare_swap_oom_score_adj(short old_val, short new_val); | 32 | /* Thread is the potential origin of an oom condition; kill first on oom */ |
33 | extern short test_set_oom_score_adj(short new_val); | 33 | #define OOM_FLAG_ORIGIN ((__force oom_flags_t)0x1) |
34 | |||
35 | static inline void set_current_oom_origin(void) | ||
36 | { | ||
37 | current->signal->oom_flags |= OOM_FLAG_ORIGIN; | ||
38 | } | ||
39 | |||
40 | static inline void clear_current_oom_origin(void) | ||
41 | { | ||
42 | current->signal->oom_flags &= ~OOM_FLAG_ORIGIN; | ||
43 | } | ||
44 | |||
45 | static inline bool oom_task_origin(const struct task_struct *p) | ||
46 | { | ||
47 | return !!(p->signal->oom_flags & OOM_FLAG_ORIGIN); | ||
48 | } | ||
34 | 49 | ||
35 | extern unsigned long oom_badness(struct task_struct *p, | 50 | extern unsigned long oom_badness(struct task_struct *p, |
36 | struct mem_cgroup *memcg, const nodemask_t *nodemask, | 51 | struct mem_cgroup *memcg, const nodemask_t *nodemask, |