From 92cd2e7fa82d917cc2d49e0118f142799ec65bc3 Mon Sep 17 00:00:00 2001 From: Chen Wandun Date: Wed, 9 Feb 2022 15:36:39 +0800 Subject: [PATCH] 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: Chen Wandun Reviewed-by: Kefeng Wang Signed-off-by: Yang Yingliang --- mm/vmscan.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c index 0623580de1f9..efe572fd090c 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) -- GitLab