From: Greg Kroah-Hartman Date: Fri, 21 Mar 2014 21:23:08 +0000 (-0700) Subject: 3.10-stable patches X-Git-Tag: v3.4.84~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c50157cbf993965f689dd947a26acb8a60c7439;p=thirdparty%2Fkernel%2Fstable-queue.git 3.10-stable patches added patches: memcg-reparent-charges-of-children-before-processing-parent.patch --- 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 index 00000000000..4a194d0707d --- /dev/null +++ b/queue-3.10/memcg-reparent-charges-of-children-before-processing-parent.patch @@ -0,0 +1,75 @@ +From 4fb1a86fb5e4209a7d4426d4e586c58e9edc74ac Mon Sep 17 00:00:00 2001 +From: Filipe Brandenburger +Date: Mon, 3 Mar 2014 15:38:25 -0800 +Subject: memcg: reparent charges of children before processing parent + +From: Filipe Brandenburger + +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 +Signed-off-by: Hugh Dickins +Reviewed-by: Tejun Heo +Acked-by: Michal Hocko +Cc: Johannes Weiner +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + + +--- + 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); + } + diff --git a/queue-3.10/series b/queue-3.10/series index 9012c8f18ef..1c75866e34d 100644 --- a/queue-3.10/series +++ b/queue-3.10/series @@ -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