From: Chen Wandun chenwandun@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4SK3S CVE: NA
--------------------------------
If page cache is over limit, it will trigger page cache reclaimation, only page cache should be reclaimed, but slab will be reclaimed by default in shrink_node, so disable shrink_slab by adding a control parameter in scan_control.
Signed-off-by: Chen Wandun chenwandun@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- mm/vmscan.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c index a9fca07dba3ba..0623580de1f9b 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -101,6 +101,9 @@ struct scan_control { /* One of the zones is ready for compaction */ unsigned int compaction_ready:1;
+ /* can't shrink slab pages */ + unsigned int no_shrink_slab:1; + /* Allocation order */ s8 order;
@@ -2783,8 +2786,9 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc) shrink_node_memcg(pgdat, memcg, sc, &lru_pages); node_lru_pages += lru_pages;
- shrink_slab(sc->gfp_mask, pgdat->node_id, - memcg, sc->priority); + if (!sc->no_shrink_slab) + shrink_slab(sc->gfp_mask, pgdat->node_id, + memcg, sc->priority);
/* Record the group's reclaim efficiency */ vmpressure(sc->gfp_mask, memcg, false, @@ -3970,6 +3974,7 @@ static unsigned long __shrink_page_cache(gfp_t mask) (unsigned long)vm_cache_reclaim_weight, .may_unmap = 1, .may_swap = mem_reliable_is_enabled() ? 0 : 1, + .no_shrink_slab = mem_reliable_is_enabled() ? 0 : 1, .order = 0, .priority = DEF_PRIORITY, .target_mem_cgroup = NULL,