Skip to content

Commit

Permalink
oom: filter tasks not sharing the same cpuset
Browse files Browse the repository at this point in the history
Tasks that do not share the same set of allowed nodes with the task that
triggered the oom should not be considered as candidates for oom kill.

Tasks in other cpusets with a disjoint set of mems would be unfairly
penalized otherwise because of oom conditions elsewhere; an extreme
example could unfairly kill all other applications on the system if a
single task in a user's cpuset sets itself to OOM_DISABLE and then uses
more memory than allowed.

Killing tasks outside of current's cpuset rarely would free memory for
current anyway.  To use a sane heuristic, we must ensure that killing a
task would likely free memory for current and avoid needlessly killing
others at all costs just because their potential memory freeing is
unknown.  It is better to kill current than another task needlessly.

Signed-off-by: David Rientjes <rientjes@google.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Nick Piggin <npiggin@suse.de>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: 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>
  • Loading branch information
David Rientjes authored and Linus Torvalds committed Aug 10, 2010
1 parent 4358997 commit 6cf86ac
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions mm/oom_kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,6 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
if (has_capability_noaudit(p, CAP_SYS_RAWIO))
points /= 4;

/*
* If p's nodes don't overlap ours, it may still help to kill p
* because p may have allocated or otherwise mapped memory on
* this node before. However it will be less likely.
*/
if (!has_intersects_mems_allowed(p))
points /= 8;

/*
* Adjust the score by oom_adj.
*/
Expand Down Expand Up @@ -277,6 +269,8 @@ static struct task_struct *select_bad_process(unsigned long *ppoints,
continue;
if (mem && !task_in_mem_cgroup(p, mem))
continue;
if (!has_intersects_mems_allowed(p))
continue;

/*
* This task already has access to memory reserves and is
Expand Down

0 comments on commit 6cf86ac

Please sign in to comment.