linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [BUGFIX][PATCH] memcg: fix oom killing a child process in an other cgroup
@ 2010-02-12  1:53 KAMEZAWA Hiroyuki
  2010-02-12  2:20 ` Daisuke Nishimura
  2010-02-12  2:39 ` Minchan Kim
  0 siblings, 2 replies; 4+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-02-12  1:53 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, linux-mm, stable, minchan.kim, rientjes, balbir, nishimura

This patch itself is againt mmotm-Feb10 but can be applied to 2.6.32.8
without problem.

==
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Now, oom-killer is memcg aware and it finds the worst process from
processes under memcg(s) in oom. Then, it kills victim's child at first.
It may kill a child in other cgroup and may not be any help for recovery.
And it will break the assumption users have...

This patch fixes it.

CC: stable@kernel.org
CC: Minchan Kim <minchan.kim@gmail.com>
CC: Balbir Singh <balbir@linux.vnet.ibm.com>
CC: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

---
 mm/oom_kill.c |    2 ++
 1 file changed, 2 insertions(+)

Index: mmotm-2.6.33-Feb10/mm/oom_kill.c
===================================================================
--- mmotm-2.6.33-Feb10.orig/mm/oom_kill.c
+++ mmotm-2.6.33-Feb10/mm/oom_kill.c
@@ -459,6 +459,8 @@ static int oom_kill_process(struct task_
 	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;
 	}

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUGFIX][PATCH] memcg: fix oom killing a child process in an other cgroup
  2010-02-12  1:53 [BUGFIX][PATCH] memcg: fix oom killing a child process in an other cgroup KAMEZAWA Hiroyuki
@ 2010-02-12  2:20 ` Daisuke Nishimura
  2010-02-12  2:39 ` Minchan Kim
  1 sibling, 0 replies; 4+ messages in thread
From: Daisuke Nishimura @ 2010-02-12  2:20 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: akpm, linux-kernel, linux-mm, stable, minchan.kim, rientjes,
	balbir, Daisuke Nishimura

On Fri, 12 Feb 2010 10:53:18 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> This patch itself is againt mmotm-Feb10 but can be applied to 2.6.32.8
> without problem.
> 
> ==
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> Now, oom-killer is memcg aware and it finds the worst process from
> processes under memcg(s) in oom. Then, it kills victim's child at first.
> It may kill a child in other cgroup and may not be any help for recovery.
> And it will break the assumption users have...
> 
> This patch fixes it.
> 
This bug should definitely be fixed. Thank you for finding and fixing it.

	Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>

> CC: stable@kernel.org
> CC: Minchan Kim <minchan.kim@gmail.com>
> CC: Balbir Singh <balbir@linux.vnet.ibm.com>
> CC: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> Acked-by: David Rientjes <rientjes@google.com>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> ---
>  mm/oom_kill.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> Index: mmotm-2.6.33-Feb10/mm/oom_kill.c
> ===================================================================
> --- mmotm-2.6.33-Feb10.orig/mm/oom_kill.c
> +++ mmotm-2.6.33-Feb10/mm/oom_kill.c
> @@ -459,6 +459,8 @@ static int oom_kill_process(struct task_
>  	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;
>  	}
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUGFIX][PATCH] memcg: fix oom killing a child process in an other cgroup
  2010-02-12  1:53 [BUGFIX][PATCH] memcg: fix oom killing a child process in an other cgroup KAMEZAWA Hiroyuki
  2010-02-12  2:20 ` Daisuke Nishimura
@ 2010-02-12  2:39 ` Minchan Kim
  2010-02-12  2:41   ` KAMEZAWA Hiroyuki
  1 sibling, 1 reply; 4+ messages in thread
From: Minchan Kim @ 2010-02-12  2:39 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: akpm, linux-kernel, linux-mm, stable, rientjes, balbir, nishimura

On Fri, Feb 12, 2010 at 10:53 AM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@jp.fujitsu.com> wrote:
> This patch itself is againt mmotm-Feb10 but can be applied to 2.6.32.8
> without problem.
>
> ==
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
> Now, oom-killer is memcg aware and it finds the worst process from
> processes under memcg(s) in oom. Then, it kills victim's child at first.
> It may kill a child in other cgroup and may not be any help for recovery.
> And it will break the assumption users have...
>
> This patch fixes it.
>
> CC: stable@kernel.org
> CC: Minchan Kim <minchan.kim@gmail.com>
> CC: Balbir Singh <balbir@linux.vnet.ibm.com>
> CC: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> Acked-by: David Rientjes <rientjes@google.com>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>

Sorry for noise, Kame.

-- 
Kind regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUGFIX][PATCH] memcg: fix oom killing a child process in an other cgroup
  2010-02-12  2:39 ` Minchan Kim
@ 2010-02-12  2:41   ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 4+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-02-12  2:41 UTC (permalink / raw)
  To: Minchan Kim
  Cc: akpm, linux-kernel, linux-mm, stable, rientjes, balbir, nishimura

On Fri, 12 Feb 2010 11:39:35 +0900
Minchan Kim <minchan.kim@gmail.com> wrote:

> On Fri, Feb 12, 2010 at 10:53 AM, KAMEZAWA Hiroyuki
> <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > This patch itself is againt mmotm-Feb10 but can be applied to 2.6.32.8
> > without problem.
> >
> > ==
> > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> >
> > Now, oom-killer is memcg aware and it finds the worst process from
> > processes under memcg(s) in oom. Then, it kills victim's child at first.
> > It may kill a child in other cgroup and may not be any help for recovery.
> > And it will break the assumption users have...
> >
> > This patch fixes it.
> >
> > CC: stable@kernel.org
> > CC: Minchan Kim <minchan.kim@gmail.com>
> > CC: Balbir Singh <balbir@linux.vnet.ibm.com>
> > CC: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> > Acked-by: David Rientjes <rientjes@google.com>
> > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
> 
> Sorry for noise, Kame.
> 
No problem. You give me a chance to consider other problems/dirtiness of codes.
I continue review to make memcg cleaer.

Thanks,
-Kame

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-02-12  2:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-12  1:53 [BUGFIX][PATCH] memcg: fix oom killing a child process in an other cgroup KAMEZAWA Hiroyuki
2010-02-12  2:20 ` Daisuke Nishimura
2010-02-12  2:39 ` Minchan Kim
2010-02-12  2:41   ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox