linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [BUGFIX][PATCH] memcg fix wake up in oom wait queue
@ 2010-06-03  8:23 KAMEZAWA Hiroyuki
  2010-06-04  1:08 ` Daisuke Nishimura
  0 siblings, 1 reply; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-06-03  8:23 UTC (permalink / raw)
  To: linux-mm; +Cc: linux-kernel, akpm, nishimura, balbir

Very sorry that my test wasn't enough and delayed.

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

OOM-waitqueue should be waken up when oom_disable is canceled.
This is a fix for
 memcg-oom-kill-disable-and-oom-status.patch

How to test:
 Create a cgroup A...
 1. set memory.limit and memory.memsw.limit to be small value
 2. echo 1 > /cgroup/A/memory.oom_control, this disables oom-kill.
 3. run a program which must cause OOM.

A program executed in 3 will sleep by oom_waiqueue in memcg.
Then, how to wake it up is problem.

 1. echo 0 > /cgroup/A/memory.oom_control (enable OOM-killer)
 2. echo big mem > /cgroup/A/memory.memsw.limit_in_bytes(allow more swap)
etc..

Without the patch, a task in slept can not be waken up.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 mm/memcontrol.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: mmotm-2.6.34-May21/mm/memcontrol.c
===================================================================
--- mmotm-2.6.34-May21.orig/mm/memcontrol.c
+++ mmotm-2.6.34-May21/mm/memcontrol.c
@@ -1413,7 +1413,7 @@ static void memcg_wakeup_oom(struct mem_
 
 static void memcg_oom_recover(struct mem_cgroup *mem)
 {
-	if (mem->oom_kill_disable && atomic_read(&mem->oom_lock))
+	if (atomic_read(&mem->oom_lock))
 		memcg_wakeup_oom(mem);
 }
 
@@ -3830,6 +3830,8 @@ static int mem_cgroup_oom_control_write(
 		return -EINVAL;
 	}
 	mem->oom_kill_disable = val;
+	if (!val)
+		memcg_oom_recover(mem);
 	cgroup_unlock();
 	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] 5+ messages in thread

* Re: [BUGFIX][PATCH] memcg fix wake up in oom wait queue
  2010-06-03  8:23 [BUGFIX][PATCH] memcg fix wake up in oom wait queue KAMEZAWA Hiroyuki
@ 2010-06-04  1:08 ` Daisuke Nishimura
  2010-06-04  1:22   ` KAMEZAWA Hiroyuki
  2010-06-04  2:58   ` KAMEZAWA Hiroyuki
  0 siblings, 2 replies; 5+ messages in thread
From: Daisuke Nishimura @ 2010-06-04  1:08 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki; +Cc: linux-mm, linux-kernel, akpm, balbir, Daisuke Nishimura

On Thu, 3 Jun 2010 17:23:53 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> Very sorry that my test wasn't enough and delayed.
> 
> ==
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> OOM-waitqueue should be waken up when oom_disable is canceled.
> This is a fix for
>  memcg-oom-kill-disable-and-oom-status.patch
> 
> How to test:
>  Create a cgroup A...
>  1. set memory.limit and memory.memsw.limit to be small value
>  2. echo 1 > /cgroup/A/memory.oom_control, this disables oom-kill.
>  3. run a program which must cause OOM.
> 
> A program executed in 3 will sleep by oom_waiqueue in memcg.
> Then, how to wake it up is problem.
> 
>  1. echo 0 > /cgroup/A/memory.oom_control (enable OOM-killer)
>  2. echo big mem > /cgroup/A/memory.memsw.limit_in_bytes(allow more swap)
> etc..
> 
> Without the patch, a task in slept can not be waken up.
> 

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

> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
>  mm/memcontrol.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> Index: mmotm-2.6.34-May21/mm/memcontrol.c
> ===================================================================
> --- mmotm-2.6.34-May21.orig/mm/memcontrol.c
> +++ mmotm-2.6.34-May21/mm/memcontrol.c
> @@ -1413,7 +1413,7 @@ static void memcg_wakeup_oom(struct mem_
>  
>  static void memcg_oom_recover(struct mem_cgroup *mem)
>  {
> -	if (mem->oom_kill_disable && atomic_read(&mem->oom_lock))
> +	if (atomic_read(&mem->oom_lock))
>  		memcg_wakeup_oom(mem);
>  }
>  
> @@ -3830,6 +3830,8 @@ static int mem_cgroup_oom_control_write(
>  		return -EINVAL;
>  	}
>  	mem->oom_kill_disable = val;
> +	if (!val)
> +		memcg_oom_recover(mem);
>  	cgroup_unlock();
>  	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] 5+ messages in thread

* Re: [BUGFIX][PATCH] memcg fix wake up in oom wait queue
  2010-06-04  1:08 ` Daisuke Nishimura
@ 2010-06-04  1:22   ` KAMEZAWA Hiroyuki
  2010-06-04  2:58   ` KAMEZAWA Hiroyuki
  1 sibling, 0 replies; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-06-04  1:22 UTC (permalink / raw)
  To: Daisuke Nishimura; +Cc: linux-mm, linux-kernel, akpm, balbir

On Fri, 4 Jun 2010 10:08:11 +0900
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:

> On Thu, 3 Jun 2010 17:23:53 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > Very sorry that my test wasn't enough and delayed.
> > 
> > ==
> > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > 
> > OOM-waitqueue should be waken up when oom_disable is canceled.
> > This is a fix for
> >  memcg-oom-kill-disable-and-oom-status.patch
> > 
> > How to test:
> >  Create a cgroup A...
> >  1. set memory.limit and memory.memsw.limit to be small value
> >  2. echo 1 > /cgroup/A/memory.oom_control, this disables oom-kill.
> >  3. run a program which must cause OOM.
> > 
> > A program executed in 3 will sleep by oom_waiqueue in memcg.
> > Then, how to wake it up is problem.
> > 
> >  1. echo 0 > /cgroup/A/memory.oom_control (enable OOM-killer)
> >  2. echo big mem > /cgroup/A/memory.memsw.limit_in_bytes(allow more swap)
> > etc..
> > 
> > Without the patch, a task in slept can not be waken up.
> > 
> 
> Acked-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> 
Thanks. I'll try to rebase this onto the latest mmotm.

-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] 5+ messages in thread

* [BUGFIX][PATCH] memcg fix wake up in oom wait queue
  2010-06-04  1:08 ` Daisuke Nishimura
  2010-06-04  1:22   ` KAMEZAWA Hiroyuki
@ 2010-06-04  2:58   ` KAMEZAWA Hiroyuki
  2010-06-04  8:07     ` KAMEZAWA Hiroyuki
  1 sibling, 1 reply; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-06-04  2:58 UTC (permalink / raw)
  To: Daisuke Nishimura; +Cc: linux-mm, linux-kernel, akpm, balbir

Tested on mmotm-2010-06-03 and works well.
==
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

OOM-waitqueue should be waken up when oom_disable is canceled.
This is a fix for
 memcg-oom-kill-disable-and-oom-status.patch

How to test:
 Create a cgroup A...
 1. set memory.limit and memory.memsw.limit to be small value
 2. echo 1 > /cgroup/A/memory.oom_control, this disables oom-kill.
 3. run a program which must cause OOM.

A program executed in 3 will sleep by oom_waiqueue in memcg.
Then, how to wake it up is problem.

 1. echo 0 > /cgroup/A/memory.oom_control (enable OOM-killer)
 2. echo big mem > /cgroup/A/memory.memsw.limit_in_bytes(allow more swap)
etc..

Without the patch, a task in slept can not be waken up.

Changelog: 2010/06/04
Rebased onto mmotm-2010-06-03-16-36

Acked-by: Acked-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 mm/memcontrol.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: mmotm-2.6.34-Jun6/mm/memcontrol.c
===================================================================
--- mmotm-2.6.34-Jun6.orig/mm/memcontrol.c
+++ mmotm-2.6.34-Jun6/mm/memcontrol.c
@@ -1370,7 +1370,7 @@ static void memcg_wakeup_oom(struct mem_
 
 static void memcg_oom_recover(struct mem_cgroup *mem)
 {
-	if (mem->oom_kill_disable && atomic_read(&mem->oom_lock))
+	if (atomic_read(&mem->oom_lock))
 		memcg_wakeup_oom(mem);
 }
 
@@ -3781,6 +3781,8 @@ static int mem_cgroup_oom_control_write(
 		return -EINVAL;
 	}
 	mem->oom_kill_disable = val;
+	if (!val)
+		memcg_oom_recover(mem);
 	cgroup_unlock();
 	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] 5+ messages in thread

* Re: [BUGFIX][PATCH] memcg fix wake up in oom wait queue
  2010-06-04  2:58   ` KAMEZAWA Hiroyuki
@ 2010-06-04  8:07     ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-06-04  8:07 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki; +Cc: Daisuke Nishimura, linux-mm, linux-kernel, akpm, balbir

On Fri, 4 Jun 2010 11:58:20 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

> Tested on mmotm-2010-06-03 and works well.
> ==
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> OOM-waitqueue should be waken up when oom_disable is canceled.
> This is a fix for
>  memcg-oom-kill-disable-and-oom-status.patch
> 
Sorry, I found linux-2.6.git has the oom_control patch, so this patch
should be against linux-2.6.git. But maybe no HUNK, I think.

Regards,
-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] 5+ messages in thread

end of thread, other threads:[~2010-06-04  8:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-03  8:23 [BUGFIX][PATCH] memcg fix wake up in oom wait queue KAMEZAWA Hiroyuki
2010-06-04  1:08 ` Daisuke Nishimura
2010-06-04  1:22   ` KAMEZAWA Hiroyuki
2010-06-04  2:58   ` KAMEZAWA Hiroyuki
2010-06-04  8:07     ` KAMEZAWA Hiroyuki

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