diff options
author | Miaohe Lin <linmiaohe@huawei.com> | 2022-04-29 08:15:58 +0200 |
---|---|---|
committer | akpm <akpm@linux-foundation.org> | 2022-04-29 08:15:58 +0200 |
commit | d8f653386cb571b46e9ce7d9681d6dc4eae441d6 (patch) | |
tree | 9de5560fd56af2f5add432a105c2d7c58d6ced8c /mm/memcontrol.c | |
parent | mm: shmem: make shmem_init return void (diff) | |
download | linux-d8f653386cb571b46e9ce7d9681d6dc4eae441d6.tar.xz linux-d8f653386cb571b46e9ce7d9681d6dc4eae441d6.zip |
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@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 598fece89e2b..09df048c5aee 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3387,7 +3387,6 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, 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_reclaim(pg_data_t *pgdat, int order, 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); |