Skip to content

Commit

Permalink
memcg: fix oom killing a child process in an other cgroup
Browse files Browse the repository at this point in the history
Presently the oom-killer is memcg aware and it finds the worst process
from processes under memcg(s) in oom.  Then, it kills victim's child
first.

It may kill a child in another cgroup and may not be any help for
recovery.  And it will break the assumption users have.

This patch fixes it.

Signed-off-by: KAMEZAWA Hiroyuki <[email protected]>
Reviewed-by: Minchan Kim <[email protected]>
Cc: Balbir Singh <[email protected]>
Reviewed-by: Daisuke Nishimura <[email protected]>
Acked-by: David Rientjes <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
hkamezawa authored and torvalds committed Feb 23, 2010
1 parent bee415c commit 5a2d419
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mm/oom_kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
list_for_each_entry(c, &p->children, sibling) {
if (c->mm == p->mm)
continue;
if (mem && !task_in_mem_cgroup(c, mem))
continue;
if (!oom_kill_task(c))
return 0;
}
Expand Down

0 comments on commit 5a2d419

Please sign in to comment.