mm-increment-gen-before-restarting-traversal.patch removed from -mm tree
The quilt patch titled
Subject: mm: increment gen # before restarting traversal
has been removed from the -mm tree. Its filename was
mm-increment-gen-before-restarting-traversal.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Kinsey Ho <[email protected]>
Subject: mm: increment gen # before restarting traversal
Date: Thu, 5 Sep 2024 00:30:52 +0000
The generation number in struct mem_cgroup_reclaim_iter should be incremented on every round-trip. Currently, it is possible for a concurrent reclaimer to jump in at the end of the hierarchy, causing a traversal restart (resetting the iteration position) without incrementing the generation number.
By resetting the position without incrementing the generation, it's possible for another ongoing mem_cgroup_iter() thread to walk the tree twice.
Move the traversal restart such that the generation number is incremented before the restart.
---
mm/memcontrol.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
mm/memcontrol.c renamed from mm/memcontrol.c~mm-increment-gen-before-restarting-traversal +12 -10
@@ -997,7 +997,7 @@ struct mem_cgroup *mem_cgroup_iter(struc root = root_mem_cgroup;rcu_read_lock (); - +restart:if (reclaim) {struct mem_cgroup_per_node *mz;
@@ -1024,14 +1024,6 @@ struct mem_cgroup *mem_cgroup_iter(strucfor (;;) { css =css_next_descendant_pre (css, &root->css);if (!css) { -/* -* Reclaimers share the hierarchy walk, and a -* new one might jump in right at the end of -* the hierarchy - make sure they see at least -* one group and restart from the beginning. -*/ -if (!prev) -continue ;break ; }
@@ -1054,8 +1046,18 @@ struct mem_cgroup *mem_cgroup_iter(struc*/ (void )cmpxchg (&iter->position, pos, memcg); -if (!memcg) +if (!memcg) { iter->generation++; + +/* +* Reclaimers share the hierarchy walk, and a +* new one might jump in right at the end of +* the hierarchy - make sure they see at least +* one group and restart from the beginning. +*/ +if (!prev) + goto restart; + } } out_unlock:
_
Patches currently in -mm which might be from [email protected] are