[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100304130406.95789929.nishimura@mxp.nes.nec.co.jp>
Date: Thu, 4 Mar 2010 13:04:06 +0900
From: Daisuke Nishimura <nishimura@....nes.nec.co.jp>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc: "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"balbir@...ux.vnet.ibm.com" <balbir@...ux.vnet.ibm.com>,
rientjes@...gle.com,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Daisuke Nishimura <nishimura@....nes.nec.co.jp>
Subject: Re: [BUGFIX][PATCH] memcg: fix oom kill behavior v3
On Wed, 3 Mar 2010 16:23:04 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:
> On Wed, 3 Mar 2010 09:38:44 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:
>
> > On Wed, 3 Mar 2010 09:26:06 +0900
> > Daisuke Nishimura <nishimura@....nes.nec.co.jp> 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@....nes.nec.co.jp>
> > > Tested-by: Daisuke Nishimura <nishimura@....nes.nec.co.jp>
> > >
> >
> > 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@....nes.nec.co.jp>
We must avoid making oom_lock of a newly created child be negative.
Signed-off-by: Daisuke Nishimura <nishimura@....nes.nec.co.jp>
---
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists