[PATCH v2 3/4] memcg: bail out proactive reclaim when memcg is dying
From: Jiayuan Chen
Date: Mon Jun 29 2026 - 21:30:35 EST
From: Jiayuan Chen <jiayuan.chen@xxxxxxxxxx>
Proactive reclaim via memory.reclaim can run for a long time - swap I/O
or thrashing again dominating the latency - and delays cgroup removal in
the same way.
Mitigate this by stopping the reclaim once memcg_is_dying().
Reported-by: Zhou Yingfu <yingfu.zhou@xxxxxxxxxx>
Cc: Jiayuan Chen <jiayuan.chen@xxxxxxxxx>
Signed-off-by: Jiayuan Chen <jiayuan.chen@xxxxxxxxxx>
---
mm/vmscan.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 754c5f5d716a..091b609cf1b1 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -7912,6 +7912,9 @@ int user_proactive_reclaim(char *buf,
if (signal_pending(current))
return -EINTR;
+ if (memcg && memcg_is_dying(memcg))
+ return -EAGAIN;
+
/*
* This is the final attempt, drain percpu lru caches in the
* hope of introducing more evictable pages.
--
2.43.0