[Devel] [PATCH rh7 6/8] mm/mem_cgroup_iter: Don't bother checking 'dead_count' anymore

Konstantin Khorenko khorenko at virtuozzo.com
Sat Feb 20 12:24:12 MSK 2021


As we've enhanced mem_cgroup_iter_invalidate() to NULL-ify
'last_visited' if it stored dying cgroups, we can be sure
iter->last_visited always contain valid pointer to memcg
(or NULL surely).

So just skip extra check iter->last_dead_count vs root->dead_count,
it's not needed anymore.

Note: the patch is not as small as possible - for review simplicity.
Cleanup patch will follow.

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

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

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index d60dc768f762..39b3350eddf9 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1646,11 +1646,8 @@ mem_cgroup_iter_load(struct mem_cgroup_reclaim_iter *iter,
 	 * offlining.  The RCU lock ensures the object won't be
 	 * released, tryget will fail if we lost the race.
 	 */
-	*sequence = atomic_read(&root->dead_count);
 retry:
-	position = NULL;
 	seq = read_seqbegin(&iter->last_visited_lock);
-	if (iter->last_dead_count == *sequence) {
 		position = READ_ONCE(iter->last_visited);
 
 		if (read_seqretry(&iter->last_visited_lock, seq))
@@ -1666,7 +1663,6 @@ mem_cgroup_iter_load(struct mem_cgroup_reclaim_iter *iter,
 				!css_tryget(&position->css))
 
 			position = NULL;
-	}
 	return position;
 }
 
-- 
2.24.3



More information about the Devel mailing list