diff mbox series

[v2,2/4] PM: freezer: Print tasks stuck in D-state during freeze

Message ID 20250619035355.33402-3-zhangzihuan@kylinos.cn
State New
Headers show
Series PM: freezer: Add retry stats and D-state task logging for debugging | expand

Commit Message

Zihuan Zhang June 19, 2025, 3:53 a.m. UTC
To help diagnose freezing delays caused by tasks stuck in D-state, this
patch adds logging for tasks that are stuck in D-state during each retry
of the freezer loop.  Such tasks are not killable and cannot be frozen,
which can cause the system suspend process to retry many times
before aborting.  This message can help developers identify which
user-space or kernel tasks are blocking the freeze process.

Signed-off-by: Zihuan Zhang <zhangzihuan@kylinos.cn>
---
 kernel/power/process.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/kernel/power/process.c b/kernel/power/process.c
index 87616ca710ac..4007f621c2ad 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -55,6 +55,9 @@  static int try_to_freeze_tasks(bool user_only)
 			if (p == current || !freeze_task(p))
 				continue;
 
+			if (retry > 1 && READ_ONCE(p->__state) == TASK_UNINTERRUPTIBLE)
+				sched_show_task(p);
+
 			todo++;
 		}
 		read_unlock(&tasklist_lock);