提交 25d463b5 编写于 作者: C Chen Wandun 提交者: Yang Yingliang

mm/vmscan: dont do shrink_slab in reclaim page cache

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: NChen Wandun <chenwandun@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 94ee86c7
...@@ -101,6 +101,9 @@ struct scan_control { ...@@ -101,6 +101,9 @@ struct scan_control {
/* One of the zones is ready for compaction */ /* One of the zones is ready for compaction */
unsigned int compaction_ready:1; unsigned int compaction_ready:1;
/* can't shrink slab pages */
unsigned int no_shrink_slab:1;
/* Allocation order */ /* Allocation order */
s8 order; s8 order;
...@@ -2783,6 +2786,7 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc) ...@@ -2783,6 +2786,7 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)
shrink_node_memcg(pgdat, memcg, sc, &lru_pages); shrink_node_memcg(pgdat, memcg, sc, &lru_pages);
node_lru_pages += lru_pages; node_lru_pages += lru_pages;
if (!sc->no_shrink_slab)
shrink_slab(sc->gfp_mask, pgdat->node_id, shrink_slab(sc->gfp_mask, pgdat->node_id,
memcg, sc->priority); memcg, sc->priority);
...@@ -3970,6 +3974,7 @@ static unsigned long __shrink_page_cache(gfp_t mask) ...@@ -3970,6 +3974,7 @@ static unsigned long __shrink_page_cache(gfp_t mask)
(unsigned long)vm_cache_reclaim_weight, (unsigned long)vm_cache_reclaim_weight,
.may_unmap = 1, .may_unmap = 1,
.may_swap = mem_reliable_is_enabled() ? 0 : 1, .may_swap = mem_reliable_is_enabled() ? 0 : 1,
.no_shrink_slab = mem_reliable_is_enabled() ? 0 : 1,
.order = 0, .order = 0,
.priority = DEF_PRIORITY, .priority = DEF_PRIORITY,
.target_mem_cgroup = NULL, .target_mem_cgroup = NULL,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册