[rh7,v4,5/9] mm/mem_cgroup_iter: Provide _iter_invalidate() the dying memcg as an argument

Submitted by Konstantin Khorenko on Feb. 24, 2021, 6:55 p.m.

Details

Message ID 20210224185541.862-6-khorenko@virtuozzo.com
State New
Series "mm/mem_cgroup_iter: Reduce the number of iterator restarts upon cgroup removals"
Headers show

Commit Message

Konstantin Khorenko Feb. 24, 2021, 6:55 p.m.
It will be used by next patches when we search for this pointer
stored in iterators.

https://jira.sw.ru/browse/PSBM-123655

Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 mm/memcontrol.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index d0251d27de00..4c9db4544d0c 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1575,7 +1575,8 @@  static struct mem_cgroup *__mem_cgroup_iter_next(struct mem_cgroup *root,
 	return NULL;
 }
 
-static void mem_cgroup_iter_invalidate(struct mem_cgroup *root)
+static void mem_cgroup_iter_invalidate(struct mem_cgroup *root,
+				       struct mem_cgroup *dead_memcg)
 {
 	/*
 	 * When a group in the hierarchy below root is destroyed, the
@@ -6872,14 +6873,14 @@  static void mem_cgroup_invalidate_reclaim_iterators(struct mem_cgroup *memcg)
 	struct mem_cgroup *parent = memcg;
 
 	while ((parent = parent_mem_cgroup(parent)))
-		mem_cgroup_iter_invalidate(parent);
+		mem_cgroup_iter_invalidate(parent, memcg);
 
 	/*
 	 * if the root memcg is not hierarchical we have to check it
 	 * explicitely.
 	 */
 	if (!root_mem_cgroup->use_hierarchy)
-		mem_cgroup_iter_invalidate(root_mem_cgroup);
+		mem_cgroup_iter_invalidate(root_mem_cgroup, memcg);
 }
 
 static void mem_cgroup_free_all(struct mem_cgroup *memcg)