On Wed, 3 Mar 2010 16:23:04 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote: > On Wed, 3 Mar 2010 09:38:44 +0900 > KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote: > > > On Wed, 3 Mar 2010 09:26:06 +0900 > > Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx> wrote: > > > > > > I'll test this patch all through this night, and check whether it doesn't trigger > > > > global oom after memcg's oom. > > > > > > > O.K. It works well. > > > Feel free to add my signs. > > > > > > Reviewed-by: Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx> > > > Tested-by: Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx> > > > > > > > Thank you ! > > > > I'll apply Balbir's comment and post v3. > > > > rebased onto mmotm-Mar2. > tested on x86-64. > I found a small race problem. This is the fix for it. === From: Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx> We must avoid making oom_lock of a newly created child be negative. Signed-off-by: Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 3ce8c5b..9e25400 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1272,7 +1272,12 @@ static bool mem_cgroup_oom_lock(struct mem_cgroup *mem) static int mem_cgroup_oom_unlock_cb(struct mem_cgroup *mem, void *data) { - atomic_dec(&mem->oom_lock); + /* + * There is a small race window where a new child can be created after + * we called mem_cgroup_oom_lock(). Use atomic_add_unless() to avoid + * making oom_lock of such a child be negative. + */ + atomic_add_unless(&mem->oom_lock, -1, 0); return 0; } -- 1.6.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>