From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
To: akpm@linux-foundation.org
Cc: balbir@in.ibm.com, bblum@andrew.cmu.edu,
kamezawa.hiroyuki@gmail.com, menage@google.com,
miaox@cn.fujitsu.com, rientjes@google.com,
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
linux-mm <linux-mm@kvack.org>,
containers@lists.linux-foundation.org
Subject: Re: + memcg-fix-deadlock-between-cpuset-and-memcg.patch added to -mm tree
Date: Wed, 5 Jan 2011 16:51:34 +0900 [thread overview]
Message-ID: <20110105165134.46d868f4.nishimura@mxp.nes.nec.co.jp> (raw)
In-Reply-To: <201101032131.p03LVTp8029638@imap1.linux-foundation.org>
(resend with adding Cc: containers and linux-mm)
Hi, Andrew.
Thank you for picking up this patch.
But this version has a small race problem. This is a fix-up patch.
===
From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
We must clear "mc.moving_task" before waking up all waiters at the end of
task migration.
Otherwise, there can be a small race like:
mem_cgroup_clear_mc() | mem_cgroup_wait_acct_move()
---------------------------------+-----------------------------------
__mem_cgroup_clear_mc() |
wake_up_all() |
| prepare_to_wait()
| if (mc.moving_task) -> true
| schedule()
| -> noone wakes it up.
mc.moving_task = NULL |
Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
---
mm/memcontrol.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index b108b30..61678be 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4714,12 +4714,16 @@ static void mem_cgroup_clear_mc(void)
{
struct mem_cgroup *from = mc.from;
+ /*
+ * we must clear moving_task before waking up waiters at the end of
+ * task migration.
+ */
+ mc.moving_task = NULL;
__mem_cgroup_clear_mc();
spin_lock(&mc.lock);
mc.from = NULL;
mc.to = NULL;
spin_unlock(&mc.lock);
- mc.moving_task = NULL;
mem_cgroup_end_move(from);
}
--
1.7.1
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
parent reply other threads:[~2011-01-05 7:58 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <201101032131.p03LVTp8029638@imap1.linux-foundation.org>]
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=20110105165134.46d868f4.nishimura@mxp.nes.nec.co.jp \
--to=nishimura@mxp.nes.nec.co.jp \
--cc=akpm@linux-foundation.org \
--cc=balbir@in.ibm.com \
--cc=bblum@andrew.cmu.edu \
--cc=containers@lists.linux-foundation.org \
--cc=kamezawa.hiroyuki@gmail.com \
--cc=linux-mm@kvack.org \
--cc=menage@google.com \
--cc=miaox@cn.fujitsu.com \
--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