The patch titled Subject: mm/memcg: remove unneeded nr_scanned has been added to the -mm tree. Its filename is mm-memcg-remove-unneeded-nr_scanned.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-memcg-remove-unneeded-nr_scanned.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-memcg-remove-unneeded-nr_scanned.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: Miaohe Lin <linmiaohe@xxxxxxxxxx> Subject: mm/memcg: remove unneeded nr_scanned The local variable nr_scanned is unneeded as mem_cgroup_soft_reclaim always does *total_scanned += nr_scanned. So we can pass total_scanned directly to the mem_cgroup_soft_reclaim to simplify the code and save some cpu cycles of adding nr_scanned to total_scanned. Link: https://lkml.kernel.org/r/20220328114144.53389-1-linmiaohe@xxxxxxxxxx Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx> Acked-by: Michal Hocko <mhocko@xxxxxxxx> Reviewed-by: David Hildenbrand <david@xxxxxxxxxx> Reviewed-by: Roman Gushchin <roman.gushchin@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/mm/memcontrol.c~mm-memcg-remove-unneeded-nr_scanned +++ a/mm/memcontrol.c @@ -3387,7 +3387,6 @@ unsigned long mem_cgroup_soft_limit_recl int loop = 0; struct mem_cgroup_tree_per_node *mctz; unsigned long excess; - unsigned long nr_scanned; if (order > 0) return 0; @@ -3415,11 +3414,9 @@ unsigned long mem_cgroup_soft_limit_recl if (!mz) break; - nr_scanned = 0; reclaimed = mem_cgroup_soft_reclaim(mz->memcg, pgdat, - gfp_mask, &nr_scanned); + gfp_mask, total_scanned); nr_reclaimed += reclaimed; - *total_scanned += nr_scanned; spin_lock_irq(&mctz->lock); __mem_cgroup_remove_exceeded(mz, mctz); _ Patches currently in -mm which might be from linmiaohe@xxxxxxxxxx are mm-memcg-remove-unneeded-nr_scanned.patch mm-mremap-use-helper-mlock_future_check.patch mm-mlock-fix-two-bugs-in-user_shm_lock.patch mm-compaction-use-helper-isolation_suitable.patch