Skip to contentSkip to conversation

memcg-enhance-memcg-iterator-to-support-predicates-fix.patch removed from -mm tree

folded-merged [email protected] 1 participant 1 message Sep 12, 2013

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: [folded-merged] memcg-enhance-memcg-iterator-to-support-predicates-fix.patch removed from -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Thu, 12 Sep 2013 15:03:08 -0700

The patch titled
Subject: mm: fix memcg-less page reclaim
has been removed from the -mm tree. Its filename was
memcg-enhance-memcg-iterator-to-support-predicates-fix.patch

This patch was dropped because it was folded into memcg-enhance-memcg-iterator-to-support-predicates.patch

------------------------------------------------------
From: Hugh Dickins <[email protected]>
Subject: mm: fix memcg-less page reclaim

Now that everybody loves memcg, configures it on, and would not dream of booting with cgroup_disable=memory, it can pass unnoticed for weeks that memcg-less page reclaim is completely broken.

mmotm's "memcg: enhance memcg iterator to support predicates" replaces __shrink_zone()'s "do { } while (memcg);" loop by a "while (memcg) {}"
loop: which is nicer for memcg, but does nothing for !CONFIG_MEMCG or cgroup_disable=memory. Page reclaim hangs, making no progress.

Adding mem_cgroup_disabled() and once++ test there is ugly. Ideally, even a !CONFIG_MEMCG build might in future have a stub root_mem_cgroup, which would get around this: but that's not so at present.

However, it appears that nothing actually dereferences the memcg pointer in the mem_cgroup_disabled() case, here or anywhere else that case can reach mem_cgroup_iter() (mem_cgroup_iter_break() is not called in global reclaim).

So, simply pass back an ordinarily-oopsing non-NULL address the first time, and we shall hear about it if I'm wrong.

Cc Johannes Weiner <[email protected]>
Cc Michal Hocko <[email protected]>
Cc KAMEZAWA Hiroyuki <[email protected]>
Cc KOSAKI Motohiro <[email protected]>

---

 include/linux/memcontrol.h |    3 ++-
 mm/memcontrol.c            |    6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
include/linux/memcontrol.h renamed from include/linux/memcontrol.h~memcg-enhance-memcg-iterator-to-support-predicates-fix +2 -1
diff -puN include/linux/memcontrol.h~memcg-enhance-memcg-iterator-to-support-predicates-fix include/linux/memcontrol.h
@@ -328,7 +328,8 @@ mem_cgroup_iter_cond(struct mem_cgroup *
 		struct mem_cgroup_reclaim_cookie *reclaim,
 		mem_cgroup_iter_filter cond)
 {
-	return NULL;
+	/* first call must return non-NULL, second return NULL */
+	return (struct mem_cgroup *)(unsigned long)!prev;
 }
 
 static inline struct mem_cgroup *
mm/memcontrol.c renamed from mm/memcontrol.c~memcg-enhance-memcg-iterator-to-support-predicates-fix +4 -2
diff -puN mm/memcontrol.c~memcg-enhance-memcg-iterator-to-support-predicates-fix mm/memcontrol.c
@@ -1018,8 +1018,10 @@ struct mem_cgroup *mem_cgroup_iter_cond(
 	struct mem_cgroup *memcg = NULL;
 	struct mem_cgroup *last_visited = NULL;
 
-	if (mem_cgroup_disabled())
-		return NULL;
+	if (mem_cgroup_disabled()) {
+		/* first call must return non-NULL, second return NULL */
+		return (struct mem_cgroup *)(unsigned long)!prev;
+	}
 
 	if (!root)
 		root = root_mem_cgroup;

_

Patches currently in -mm which might be from [email protected] are

origin.patch memcg-vmscan-integrate-soft-reclaim-tighter-with-zone-shrinking-code.patch memcg-get-rid-of-soft-limit-tree-infrastructure.patch vmscan-memcg-do-softlimit-reclaim-also-for-targeted-reclaim.patch memcg-enhance-memcg-iterator-to-support-predicates.patch memcg-track-children-in-soft-limit-excess-to-improve-soft-limit.patch memcg-vmscan-do-not-attempt-soft-limit-reclaim-if-it-would-not-scan-anything.patch memcg-track-all-children-over-limit-in-the-root.patch memcg-vmscan-do-not-fall-into-reclaim-all-pass-too-quickly.patch thp-account-anon-transparent-huge-pages-into-nr_anon_pages.patch mm-cleanup-add_to_page_cache_locked.patch thp-move-maybe_pmd_mkwrite-out-of-mk_huge_pmd.patch thp-do_huge_pmd_anonymous_page-cleanup.patch thp-consolidate-code-between-handle_mm_fault-and-do_huge_pmd_anonymous_page.patch