From: Tejun Heo Subject: memcg: remove lru_add_drain_all() invocation from mem_cgroup_move_charge() Date: Thu, 21 Apr 2016 11:56:52 -0400 Origin: http://permalink.gmane.org/gmane.linux.kernel.cgroups/15918 Bug-Debian: https://bugs.debian.org/822084 mem_cgroup_move_charge() invokes lru_add_drain_all() so that the pvec pages can be moved too. lru_add_drain_all() schedules and flushes work items on system_wq which depends on being able to create new kworkers to make forward progress. Since 1ed1328792ff ("sched, cgroup: replace signal_struct->group_rwsem with a global percpu_rwsem"), a new task can't be created while in the cgroup migration path and the described lru_add_drain_all() invocation can easily lead to a deadlock. Charge moving is best-effort and whether the pvec pages are migrated or not doesn't really matter. Don't call it during charge moving. Eventually, we want to move the actual charge moving outside the migration path. Signed-off-by: Tejun Heo Debugged-and-tested-by: Petr Mladek Reported-by: Cyril Hrubis Reported-by: Johannes Weiner Suggested-by: Michal Hocko Acked-by: Michal Hocko Fixes: 1ed1328792ff ("sched, cgroup: replace signal_struct->group_rwsem with a global percpu_rwsem") Cc: stable@vger.kernel.org # v4.4+ --- mm/memcontrol.c | 1 - 1 file changed, 1 deletion(-) --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4922,7 +4922,6 @@ static void mem_cgroup_move_charge(struc .mm = mm, }; - lru_add_drain_all(); /* * Signal mem_cgroup_begin_page_stat() to take the memcg's * move_lock while we're moving its pages to another memcg.