From 761043412a87a60f1c6137279835e834e1073537 Mon Sep 17 00:00:00 2001 From: Zhang Qilong Date: Fri, 28 Nov 2025 13:10:07 +0800 Subject: [PATCH 1/2] mm: Add page cache limit check before queueing shrink worker hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ID96C0 -------------------------------- Add page cache limit check before queueing shrink worker, queueing shrink worker can be avoid if vm_cache_limit_mbytes is zero or page_cache_over_limit() returns false. Fixes: 621647ce254f ("mm: support periodical memory reclaim") Signed-off-by: Zhang Qilong --- mm/page_cache_limit.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/page_cache_limit.c b/mm/page_cache_limit.c index 05eb441f2bf2..107550117998 100644 --- a/mm/page_cache_limit.c +++ b/mm/page_cache_limit.c @@ -177,9 +177,12 @@ static void shrink_shepherd(struct work_struct *w) if (!should_periodical_reclaim()) return; - for_each_online_node(node) { - if (!work_pending(&vmscan_works[node])) - queue_work_node(node, system_unbound_wq, &vmscan_works[node]); + if (vm_cache_limit_mbytes && page_cache_over_limit()) { + for_each_online_node(node) { + if (!work_pending(&vmscan_works[node])) + queue_work_node(node, system_unbound_wq, + &vmscan_works[node]); + } } queue_delayed_work(system_unbound_wq, &shepherd, -- Gitee From 61e4088d0616112bbb4d3a69e19af5742180dd83 Mon Sep 17 00:00:00 2001 From: Zhang Qilong Date: Fri, 28 Nov 2025 13:10:08 +0800 Subject: [PATCH 2/2] mm: Replace deferrable timer with delay timer for shrink worker hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ID96C0 -------------------------------- When system is idle, the deferrable timer maybe expire in unsure time. If the system have many clean cached pages at this time, shrink worker can not be queued in excepted time. So we replace deferrable timer with delay timer for shrink worker to avoid this issue. Fixes: 621647ce254f ("mm: support periodical memory reclaim") Signed-off-by: Zhang Qilong --- mm/page_cache_limit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_cache_limit.c b/mm/page_cache_limit.c index 107550117998..34b2f6f699a0 100644 --- a/mm/page_cache_limit.c +++ b/mm/page_cache_limit.c @@ -18,7 +18,7 @@ static int vm_cache_reclaim_enable = 1; static unsigned long vm_cache_limit_mbytes __read_mostly; static void shrink_shepherd(struct work_struct *w); -static DECLARE_DEFERRABLE_WORK(shepherd, shrink_shepherd); +static DECLARE_DELAYED_WORK(shepherd, shrink_shepherd); static struct work_struct vmscan_works[MAX_NUMNODES]; static bool should_periodical_reclaim(void) -- Gitee