From: KAMEZAWA Hiroyuki on
Tested on mmotm-2010-06-03 and works well.
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu(a)>

OOM-waitqueue should be waken up when oom_disable is canceled.
This is a fix for

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)

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(a)>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu(a)>
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))

@@ -3781,6 +3781,8 @@ static int mem_cgroup_oom_control_write(
return -EINVAL;
mem->oom_kill_disable = val;
+ if (!val)
+ memcg_oom_recover(mem);
return 0;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)
More majordomo info at
Please read the FAQ at