hulk inclusion category: cleanup bugzilla: https://gitee.com/openeuler/kernel/issues/ID9H69 -------------------------------- Move vm_cache_limit_mbytes check from should_reclaim_page_cache() to page_cache_over_limit(), and call should_periodical_reclaim() directly in page cache limit handle. Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com> --- mm/page_cache_limit.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/mm/page_cache_limit.c b/mm/page_cache_limit.c index a7500f13b46b..aac6e265a3b4 100644 --- a/mm/page_cache_limit.c +++ b/mm/page_cache_limit.c @@ -36,30 +36,22 @@ static unsigned long node_reclaim_num(void) static bool page_cache_over_limit(void) { unsigned long lru_file; unsigned long limit; + if (!vm_cache_limit_mbytes) + return false; + limit = vm_cache_limit_mbytes << (20 - PAGE_SHIFT); lru_file = global_node_page_state(NR_ACTIVE_FILE) + global_node_page_state(NR_INACTIVE_FILE); if (lru_file > limit) return true; return false; } -static bool should_reclaim_page_cache(void) -{ - if (!should_periodical_reclaim()) - return false; - - if (!vm_cache_limit_mbytes) - return false; - - return true; -} - int cache_reclaim_enable_handler(struct ctl_table *table, int write, void *buffer, size_t *length, loff_t *ppos) { int ret; @@ -108,11 +100,11 @@ int cache_limit_mbytes_sysctl_handler(struct ctl_table *table, int write, vm_cache_limit_mbytes = origin_mbytes; return -EINVAL; } if (write) { - while (should_reclaim_page_cache() && page_cache_over_limit() && + while (should_periodical_reclaim() && page_cache_over_limit() && nr_retries--) { if (signal_pending(current)) return -EINTR; shrink_memory(node_reclaim_num(), false); -- 2.43.0