* Re: + memcg-fix-deadlock-between-cpuset-and-memcg.patch added to -mm tree
[not found] <201101032131.p03LVTp8029638@imap1.linux-foundation.org>
@ 2011-01-05 7:51 ` Daisuke Nishimura
0 siblings, 0 replies; only message in thread
From: Daisuke Nishimura @ 2011-01-05 7:51 UTC (permalink / raw)
To: akpm
Cc: balbir, bblum, kamezawa.hiroyuki, menage, miaox, rientjes,
Daisuke Nishimura, linux-mm, containers
(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>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-01-05 7:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <201101032131.p03LVTp8029638@imap1.linux-foundation.org>
2011-01-05 7:51 ` + memcg-fix-deadlock-between-cpuset-and-memcg.patch added to -mm tree Daisuke Nishimura
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox