]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Mar 2014 21:23:08 +0000 (14:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Mar 2014 21:23:08 +0000 (14:23 -0700)
added patches:
memcg-reparent-charges-of-children-before-processing-parent.patch

queue-3.10/memcg-reparent-charges-of-children-before-processing-parent.patch [new file with mode: 0644]
queue-3.10/series

diff --git a/queue-3.10/memcg-reparent-charges-of-children-before-processing-parent.patch b/queue-3.10/memcg-reparent-charges-of-children-before-processing-parent.patch
new file mode 100644 (file)
index 0000000..4a194d0
--- /dev/null
@@ -0,0 +1,75 @@
+From 4fb1a86fb5e4209a7d4426d4e586c58e9edc74ac Mon Sep 17 00:00:00 2001
+From: Filipe Brandenburger <filbranden@google.com>
+Date: Mon, 3 Mar 2014 15:38:25 -0800
+Subject: memcg: reparent charges of children before processing parent
+
+From: Filipe Brandenburger <filbranden@google.com>
+
+commit 4fb1a86fb5e4209a7d4426d4e586c58e9edc74ac upstream.
+
+Sometimes the cleanup after memcg hierarchy testing gets stuck in
+mem_cgroup_reparent_charges(), unable to bring non-kmem usage down to 0.
+
+There may turn out to be several causes, but a major cause is this: the
+workitem to offline parent can get run before workitem to offline child;
+parent's mem_cgroup_reparent_charges() circles around waiting for the
+child's pages to be reparented to its lrus, but it's holding
+cgroup_mutex which prevents the child from reaching its
+mem_cgroup_reparent_charges().
+
+Further testing showed that an ordered workqueue for cgroup_destroy_wq
+is not always good enough: percpu_ref_kill_and_confirm's call_rcu_sched
+stage on the way can mess up the order before reaching the workqueue.
+
+Instead, when offlining a memcg, call mem_cgroup_reparent_charges() on
+all its children (and grandchildren, in the correct order) to have their
+charges reparented first.
+
+[The version for 3.10.34 (or perhaps now 3.10.35) is this below.
+Yes, more differences, and the old mem_cgroup_reparent_charges line
+is intentionally left in for 3.10 whereas it was removed for 3.12+:
+that's because the css/cgroup iterator changed in between, it used
+not to supply the root of the subtree, but nowadays it does - Hugh]
+
+
+Fixes: e5fca243abae ("cgroup: use a dedicated workqueue for cgroup destruction")
+Signed-off-by: Filipe Brandenburger <filbranden@google.com>
+Signed-off-by: Hugh Dickins <hughd@google.com>
+Reviewed-by: Tejun Heo <tj@kernel.org>
+Acked-by: Michal Hocko <mhocko@suse.cz>
+Cc: Johannes Weiner <hannes@cmpxchg.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+
+---
+ mm/memcontrol.c |   14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/mm/memcontrol.c
++++ b/mm/memcontrol.c
+@@ -6326,9 +6326,23 @@ static void mem_cgroup_invalidate_reclai
+ static void mem_cgroup_css_offline(struct cgroup *cont)
+ {
+       struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
++      struct cgroup *iter;
+       mem_cgroup_invalidate_reclaim_iterators(memcg);
++
++      /*
++       * This requires that offlining is serialized.  Right now that is
++       * guaranteed because css_killed_work_fn() holds the cgroup_mutex.
++       */
++      rcu_read_lock();
++      cgroup_for_each_descendant_post(iter, cont) {
++              rcu_read_unlock();
++              mem_cgroup_reparent_charges(mem_cgroup_from_cont(iter));
++              rcu_read_lock();
++      }
++      rcu_read_unlock();
+       mem_cgroup_reparent_charges(memcg);
++
+       mem_cgroup_destroy_all_caches(memcg);
+ }
index 9012c8f18ef19599e905aab9ef7723abd4438145..1c75866e34dcbf4451adcfc604f46fc887f32282 100644 (file)
@@ -74,6 +74,7 @@ alsa-oxygen-modify-adjust_dg_dac_routing-function.patch
 jiffies-avoid-undefined-behavior-from-signed-overflow.patch
 s390-dasd-hold-request-queue-sysfs-lock-when-calling-elevator_init.patch
 fix-mountpoint-reference-leakage-in-linkat.patch
+memcg-reparent-charges-of-children-before-processing-parent.patch
 mips-include-linux-types.h.patch
 bio-integrity-fix-bio_integrity_verify-segment-start-bug.patch
 tick-make-oneshot-broadcast-robust-vs.-cpu-offlining.patch