lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c6c7e8b5-430b-4616-b9e8-46500621bb84@kylinos.cn>
Date: Thu, 17 Jul 2025 09:16:27 +0800
From: Zihuan Zhang <zhangzihuan@...inos.cn>
To: Oleg Nesterov <oleg@...hat.com>
Cc: "rafael J . wysocki" <rafael@...nel.org>,
 Peter Zijlstra <peterz@...radead.org>, len brown <len.brown@...el.com>,
 pavel machek <pavel@...nel.org>, linux-pm@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4] PM / Freezer: Skip zombie/dead processes to reduce
 freeze latency

Hi Oleg,

在 2025/7/17 00:38, Oleg Nesterov 写道:
> On 07/16, Zihuan Zhang wrote:
>> @@ -51,7 +51,15 @@ static int try_to_freeze_tasks(bool user_only)
>>   		todo = 0;
>>   		read_lock(&tasklist_lock);
>>   		for_each_process_thread(g, p) {
>> -			if (p == current || !freeze_task(p))
>> +			/*
>> +			 * Zombie and dead tasks are not running anymore and cannot enter
>> +			 * the __refrigerator(). Skipping them avoids unnecessary freeze attempts.
>> +			 *
>> +			 * TODO: Consider using PF_NOFREEZE instead, which may provide
>> +			 * a more generic exclusion mechanism for other non-freezable tasks.
>> +			 * However, for now, exit_state is sufficient to skip user processes.
> I don't really understand the comment... The freeze_task() paths already
> consider PF_NOFREEZE, although we can check it earlier as Peter suggests.


You’re right — freeze_task() already takes PF_NOFREEZE into account.
Our intention here is to skip zombie and dead tasks earlier to avoid 
calling freeze_task() unnecessarily, especially when the number of such 
tasks is large.

The comment is meant to highlight a possible future direction: while 
exit_state already allows us to skip all exiting user-space tasks 
safely, we may later extend the logic to skip certain kernel threads 
that set PF_NOFREEZE and never clear it (e.g., kthreadd), as suggested 
by Peter


>> +			 */
>> +			if (p == current || p->exit_state || !freeze_task(p))
>>   				continue;
> I leave this to you and Rafael, but this change doesn't look safe to me.
> What if the exiting task does some IO after exit_notify() ?


Tasks that have passed exit_notify() and entered EXIT_ZOMBIE are no 
longer schedulable, so they cannot do I/O anymore. Skipping them during 
freezing should be safe


> Oleg.
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ