From d251b99807aa112fa3e5b38f747cfe34fb97b82f Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 28 Apr 2016 15:27:24 +0200 Subject: [PATCH] memcg: remove lru_add_drain_all() invocation from mem_cgroup_move_charge() Closes: #822084 --- debian/changelog | 2 + ...vocation-from-mem_cgroup_move_charge.patch | 42 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 45 insertions(+) create mode 100644 debian/patches/bugfix/all/memcg-remove-lru_add_drain_all-invocation-from-mem_cgroup_move_charge.patch diff --git a/debian/changelog b/debian/changelog index 3e5e22fe6..0e6613dbe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -126,6 +126,8 @@ linux (4.5.2-1) UNRELEASED; urgency=medium Adrian Glaubitz (Closes: #815977) * linux-headers: Avoid mixed implicit and normal rules in Makefile, thanks to Thierry Herbelot (Closes: #822666) + * memcg: remove lru_add_drain_all() invocation from mem_cgroup_move_charge() + (Closes: #822084) [ Aurelien Jarno ] * [mips*] Emulate unaligned LDXC1 and SDXC1 instructions. diff --git a/debian/patches/bugfix/all/memcg-remove-lru_add_drain_all-invocation-from-mem_cgroup_move_charge.patch b/debian/patches/bugfix/all/memcg-remove-lru_add_drain_all-invocation-from-mem_cgroup_move_charge.patch new file mode 100644 index 000000000..c0b894645 --- /dev/null +++ b/debian/patches/bugfix/all/memcg-remove-lru_add_drain_all-invocation-from-mem_cgroup_move_charge.patch @@ -0,0 +1,42 @@ +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. diff --git a/debian/patches/series b/debian/patches/series index ab10005b1..5bd00ef0f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -152,3 +152,4 @@ bugfix/all/atl2-disable-unimplemented-scatter-gather-feature.patch bugfix/all/module-invalidate-signatures-on-force-loaded-modules.patch bugfix/sparc/sparc-implement-and-wire-up-modalias_show-for-vio.patch bugfix/sparc/sparc-implement-and-wire-up-vio_hotplug-for-vio.patch +bugfix/all/memcg-remove-lru_add_drain_all-invocation-from-mem_cgroup_move_charge.patch