提交 92cd2e7f 编写于 作者: C Chen Wandun 提交者: Yang Yingliang

mm:vmscan: add the missing check of page_cache_over_limit

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4SK3S
CVE: NA

--------------------------------

Function shrink_shepherd is used to queue each work on cpu to shrink
page cache, and it will be called periodically, but if there is no
page_cache_over_limit check before shrink page cache, it will result
in periodic memory reclamation even the number of page cache below
limit, so add basic check before shrink page cache.
Signed-off-by: NChen Wandun <chenwandun@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 a08e2009
...@@ -4056,6 +4056,10 @@ static void shrink_page_cache_work(struct work_struct *w) ...@@ -4056,6 +4056,10 @@ static void shrink_page_cache_work(struct work_struct *w)
if (vm_cache_reclaim_s == 0 || !vm_cache_reclaim_enable) if (vm_cache_reclaim_s == 0 || !vm_cache_reclaim_enable)
return; return;
if (mem_reliable_is_enabled() &&
(!vm_cache_limit_mbytes || !page_cache_over_limit()))
return;
/* It should wait more time if we hardly reclaim the page cache */ /* It should wait more time if we hardly reclaim the page cache */
nr_pages = shrink_page_cache(GFP_KERNEL); nr_pages = shrink_page_cache(GFP_KERNEL);
if ((nr_pages < SWAP_CLUSTER_MAX) && vm_cache_reclaim_enable) if ((nr_pages < SWAP_CLUSTER_MAX) && vm_cache_reclaim_enable)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册