The patch titled Subject: mm/memcg: set pos explicitly for reclaim and !reclaim has been added to the -mm tree. Its filename is mm-memcg-set-pos-explicitly-for-reclaim-and-reclaim.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-memcg-set-pos-explicitly-for-reclaim-and-reclaim.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-memcg-set-pos-explicitly-for-reclaim-and-reclaim.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Wei Yang <richard.weiyang@xxxxxxxxx> Subject: mm/memcg: set pos explicitly for reclaim and !reclaim During mem_cgroup_iter, there are two ways to get iteration position: reclaim vs non-reclaim mode. Let's do it explicitly for reclaim vs non-reclaim mode. Link: https://lkml.kernel.org/r/20220330234719.18340-3-richard.weiyang@xxxxxxxxx Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx> Reviewed-by: Roman Gushchin <roman.gushchin@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/mm/memcontrol.c~mm-memcg-set-pos-explicitly-for-reclaim-and-reclaim +++ a/mm/memcontrol.c @@ -1013,9 +1013,6 @@ struct mem_cgroup *mem_cgroup_iter(struc if (!root) root = root_mem_cgroup; - if (prev && !reclaim) - pos = prev; - rcu_read_lock(); if (reclaim) { @@ -1041,6 +1038,8 @@ struct mem_cgroup *mem_cgroup_iter(struc */ (void)cmpxchg(&iter->position, pos, NULL); } + } else if (prev) { + pos = prev; } if (pos) _ Patches currently in -mm which might be from richard.weiyang@xxxxxxxxx are mm-memcg-mz-already-removed-from-rb_tree-if-not-null.patch mm-memcg-set-memcg-after-css-verified-and-got-reference.patch mm-memcg-set-pos-explicitly-for-reclaim-and-reclaim.patch mm-memcg-move-generation-assignment-and-comparison-together.patch mm-page_alloc-add-same-penalty-is-enough-to-get-round-robin-order.patch mm-vmscan-reclaim-only-affects-managed_zones.patch mm-vmscan-make-sure-wakeup_kswapd-with-managed-zone.patch mm-vmscan-sc-reclaim_idx-must-be-a-valid-zone-index.patch