]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm/vmscan: take min_slab_pages into account when try to call shrink_node
authorMiaohe Lin <linmiaohe@huawei.com>
Fri, 13 May 2022 03:22:58 +0000 (20:22 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 13 May 2022 14:20:13 +0000 (07:20 -0700)
Since commit d3db6a53b2df ("mm: vmscan: invoke slab shrinkers from
shrink_zone()"), slab reclaim and lru page reclaim are done together in
the shrink_node.  So we should take min_slab_pages into account when try
to call shrink_node.

Link: https://lkml.kernel.org/r/20220425112118.20924-1-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/vmscan.c

index a9761b04564c4fb94cb644a41657734a01cdfb32..5ac0a71dc0dfcc0a24a226e4d9f65f8ec91070af 100644 (file)
@@ -4713,7 +4713,8 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in
        noreclaim_flag = memalloc_noreclaim_save();
        set_task_reclaim_state(p, &sc.reclaim_state);
 
-       if (node_pagecache_reclaimable(pgdat) > pgdat->min_unmapped_pages) {
+       if (node_pagecache_reclaimable(pgdat) > pgdat->min_unmapped_pages ||
+           node_page_state_pages(pgdat, NR_SLAB_RECLAIMABLE_B) > pgdat->min_slab_pages) {
                /*
                 * Free memory by calling shrink node with increasing
                 * priorities until we have enough memory freed.