[PATCH 3/3] memcg: Don't trigger hung task warnings when memcg is releasing resources.

From: Julian Sun

Date: Mon Sep 22 2025 - 05:42:07 EST


Hung task warning in mem_cgroup_css_free() is undesirable and
unnecessary since it does not affect any user behavior and there
is no misbehavior at the kernel code level.

Use wb_wait_for_completion_no_hung() to eliminate the possible
hung task warning.

Signed-off-by: Julian Sun <sunjunchao@xxxxxxxxxxxxx>
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 8dd7fbed5a94..b7d9e795dd64 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3913,7 +3913,7 @@ static void mem_cgroup_css_free(struct cgroup_subsys_state *css)

#ifdef CONFIG_CGROUP_WRITEBACK
for (i = 0; i < MEMCG_CGWB_FRN_CNT; i++)
- wb_wait_for_completion(&memcg->cgwb_frn[i].done);
+ wb_wait_for_completion_no_hung(&memcg->cgwb_frn[i].done);
#endif
if (cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgroup_memory_nosocket)
static_branch_dec(&memcg_sockets_enabled_key);
--
2.39.5