[PATCH OLK-6.6] Revert "mm: Move vm_cache_limit_mbytes check to page_cache_over_limit()"
hulk inclusion category: bugfix bugzilla: https://atomgit.com/src-openeuler/kernel/issues/13853 -------------------------------- This reverts commit 00b50cbb31ad11c0896355e351f961b1b586797f. Before this patch commit 00b50cbb31ad ("mm: Move vm_cache_limit_mbytes check to page_cache_over_limit()") was merged, setting cache_limit_mbytes to 0 meant that periodic reclaim could reclaim page cache without limitation. After the patch was merged, page cache is no longer reclaimed when cache_limit_mbytes is set to 0. As a result, periodic reclaim becomes ineffective. Revert this patch. Fixes: 00b50cbb31ad ("mm: Move vm_cache_limit_mbytes check to page_cache_over_limit()") Signed-off-by: Ze Zuo <zuoze1@huawei.com> --- mm/page_cache_limit.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/mm/page_cache_limit.c b/mm/page_cache_limit.c index 677ead24d27f..fe67b8b804f0 100644 --- a/mm/page_cache_limit.c +++ b/mm/page_cache_limit.c @@ -38,9 +38,6 @@ 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); @@ -50,6 +47,17 @@ static bool page_cache_over_limit(void) 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) { @@ -102,7 +110,7 @@ int cache_limit_mbytes_sysctl_handler(struct ctl_table *table, int write, } if (write) { - while (should_periodical_reclaim() && page_cache_over_limit() && + while (should_reclaim_page_cache() && page_cache_over_limit() && nr_retries--) { if (signal_pending(current)) return -EINTR; -- 2.25.1
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://atomgit.com/openeuler/kernel/merge_requests/21103 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/BTJ... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://atomgit.com/openeuler/kernel/merge_requests/21103 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/BTJ...
participants (2)
-
patchwork bot -
Ze Zuo