diff options
author | David Rientjes <rientjes@google.com> | 2011-05-24 20:11:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-25 11:39:10 -0400 |
commit | 72788c385604523422592249c19cba0187021e9b (patch) | |
tree | 3552a4b6ae4adb77e723d8a8d1d2669bfb04a8bb /include/linux/oom.h | |
parent | c6a140bf164829769499b5e50d380893da39b29e (diff) |
oom: replace PF_OOM_ORIGIN with toggling oom_score_adj
There's a kernel-wide shortage of per-process flags, so it's always
helpful to trim one when possible without incurring a significant penalty.
It's even more important when you're planning on adding a per- process
flag yourself, which I plan to do shortly for transparent hugepages.
PF_OOM_ORIGIN is used by ksm and swapoff to prefer current since it has a
tendency to allocate large amounts of memory and should be preferred for
killing over other tasks. We'd rather immediately kill the task making
the errant syscall rather than penalizing an innocent task.
This patch removes PF_OOM_ORIGIN since its behavior is equivalent to
setting the process's oom_score_adj to OOM_SCORE_ADJ_MAX.
The process's old oom_score_adj is stored and then set to
OOM_SCORE_ADJ_MAX during the time it used to have PF_OOM_ORIGIN. The old
value is then reinstated when the process should no longer be considered a
high priority for oom killing.
Signed-off-by: David Rientjes <rientjes@google.com>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Izik Eidus <ieidus@redhat.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/oom.h')
-rw-r--r-- | include/linux/oom.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/oom.h b/include/linux/oom.h index 5e3aa8311c5e..4952fb874ad3 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h | |||
@@ -40,6 +40,8 @@ enum oom_constraint { | |||
40 | CONSTRAINT_MEMCG, | 40 | CONSTRAINT_MEMCG, |
41 | }; | 41 | }; |
42 | 42 | ||
43 | extern int test_set_oom_score_adj(int new_val); | ||
44 | |||
43 | extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem, | 45 | extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem, |
44 | const nodemask_t *nodemask, unsigned long totalpages); | 46 | const nodemask_t *nodemask, unsigned long totalpages); |
45 | extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); | 47 | extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); |