From: Chen Wandun chenwandun@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4SK3S CVE: NA
-------------------------------------------------------
In function cache_limit_ratio_sysctl_handler and cache_limit_mbytes_sysctl_handler, it will shrink page cache even if vm_cache_reclaim_enable is false, it is unexpected.
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/page_alloc.c | 6 ++++-- mm/vmscan.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 455525e49c727..3fb21ea5dcf9b 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -8600,7 +8600,8 @@ int cache_limit_ratio_sysctl_handler(struct ctl_table *table, int write, vm_cache_limit_ratio); else pr_warn("page cache limit off\n"); - while (vm_cache_limit_mbytes && page_cache_over_limit()) + while (vm_cache_limit_mbytes && page_cache_over_limit() && + vm_cache_reclaim_enable) shrink_page_cache(GFP_KERNEL); }
@@ -8628,7 +8629,8 @@ int cache_limit_mbytes_sysctl_handler(struct ctl_table *table, int write, else pr_warn("page cache limit off\n");
- while (vm_cache_limit_mbytes && page_cache_over_limit()) + while (vm_cache_limit_mbytes && page_cache_over_limit() && + vm_cache_reclaim_enable) shrink_page_cache(GFP_KERNEL); }
diff --git a/mm/vmscan.c b/mm/vmscan.c index 208ee8653da62..39b06e6eaa0f0 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3562,7 +3562,8 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int classzone_idx) kernel_swap_check(&sc);
#ifdef CONFIG_SHRINK_PAGECACHE - if (vm_cache_limit_mbytes && page_cache_over_limit()) + if (vm_cache_limit_mbytes && page_cache_over_limit() && + vm_cache_reclaim_enable) shrink_page_cache(GFP_KERNEL); #endif