[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7f6b7ea9-8fb5-466c-b92b-fe2c20e64b0b@kylinos.cn>
Date: Fri, 4 Jul 2025 08:49:40 +0800
From: Zihuan Zhang <zhangzihuan@...inos.cn>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: pavel@...nel.org, len.brown@...el.com, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/4] PM: freezer: Print tasks stuck in D-state during
freeze
Hi Rafael,
在 2025/7/3 22:40, Rafael J. Wysocki 写道:
> On Thu, Jun 19, 2025 at 5:54 AM Zihuan Zhang <zhangzihuan@...inos.cn> wrote:
>> 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@...inos.cn>
>> ---
>> kernel/power/process.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> 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);
>> +
> This is going to be too noisy IMV. Any chance to rate limit it somehow?
Thanks for pointing this out.
To avoid excessive verbosity, I’ll make the D-state task logging
conditional on pm_debug_messages_on() being true. Additionally, I’ll
limit the logging to only occur during retry rounds 1— that should be
enough to catch problematic tasks early without spamming the logs in
prolonged freeze attempts.
+ if (pm_debug_messages_on && retry == 1 && READ_ONCE(p->__state) == TASK_UNINTERRUPTIBLE)
+ sched_show_task(p);
+
>> todo++;
>> }
>> read_unlock(&tasklist_lock);
>> --
>> 2.25.1
>>
Best regards,
Zihuan Zhang
Powered by blists - more mailing lists