[Devel] Re: + memcg-fix-deadlock-between-cpuset-and-memcg.patch added to -mm tree
Daisuke Nishimura
nishimura at mxp.nes.nec.co.jp
Tue Jan 4 23:51:34 PST 2011
(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 at 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 at 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
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list