From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
rientjes@google.com,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Subject: Re: [BUGFIX][PATCH] memcg: fix oom kill behavior v3
Date: Thu, 4 Mar 2010 13:04:06 +0900 [thread overview]
Message-ID: <20100304130406.95789929.nishimura@mxp.nes.nec.co.jp> (raw)
In-Reply-To: <20100303162304.eaf49099.kamezawa.hiroyu@jp.fujitsu.com>
On Wed, 3 Mar 2010 16:23:04 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Wed, 3 Mar 2010 09:38:44 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> > On Wed, 3 Mar 2010 09:26:06 +0900
> > Daisuke Nishimura <nishimura@mxp.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@mxp.nes.nec.co.jp>
> > > Tested-by: Daisuke Nishimura <nishimura@mxp.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@mxp.nes.nec.co.jp>
We must avoid making oom_lock of a newly created child be negative.
Signed-off-by: Daisuke Nishimura <nishimura@mxp.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, 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>
next prev parent reply other threads:[~2010-03-04 4:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-02 2:58 [BUGFIX][PATCH] memcg: fix oom kill behavior KAMEZAWA Hiroyuki
2010-03-02 4:55 ` [BUGFIX][PATCH] memcg: fix oom kill behavior v2 KAMEZAWA Hiroyuki
2010-03-02 5:37 ` Daisuke Nishimura
2010-03-02 5:56 ` KAMEZAWA Hiroyuki
2010-03-02 6:15 ` Daisuke Nishimura
2010-03-03 0:26 ` Daisuke Nishimura
2010-03-03 0:38 ` KAMEZAWA Hiroyuki
2010-03-03 7:23 ` [BUGFIX][PATCH] memcg: fix oom kill behavior v3 KAMEZAWA Hiroyuki
2010-03-03 23:12 ` Andrew Morton
2010-03-04 3:59 ` KAMEZAWA Hiroyuki
2010-03-04 4:04 ` Daisuke Nishimura [this message]
2010-03-04 4:08 ` KAMEZAWA Hiroyuki
2010-03-04 5:25 ` [BUGFIX][PATCH] memcg: fix oom kill behavior v4 KAMEZAWA Hiroyuki
2010-03-02 17:11 ` [BUGFIX][PATCH] memcg: fix oom kill behavior Balbir Singh
2010-03-02 23:58 ` KAMEZAWA Hiroyuki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100304130406.95789929.nishimura@mxp.nes.nec.co.jp \
--to=nishimura@mxp.nes.nec.co.jp \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox