From: Chen Wandun chenwandun@huawei.com
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: Chen Wandun chenwandun@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- mm/vmscan.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/mm/vmscan.c b/mm/vmscan.c index 0623580de1f9b..efe572fd090c0 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4056,6 +4056,10 @@ static void shrink_page_cache_work(struct work_struct *w) if (vm_cache_reclaim_s == 0 || !vm_cache_reclaim_enable) 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 */ nr_pages = shrink_page_cache(GFP_KERNEL); if ((nr_pages < SWAP_CLUSTER_MAX) && vm_cache_reclaim_enable)