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: <f5985910-d175-4c51-90b6-9d087a59936b@kylinos.cn>
Date: Thu, 17 Jul 2025 09:30:02 +0800
From: Zihuan Zhang <zhangzihuan@...inos.cn>
To: Peter Zijlstra <peterz@...radead.org>, Oleg Nesterov <oleg@...hat.com>
Cc: "rafael J . wysocki" <rafael@...nel.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 Peter,

在 2025/7/17 02:36, Peter Zijlstra 写道:
> On Wed, Jul 16, 2025 at 06:38:55PM +0200, Oleg Nesterov wrote:
>> 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.
> Right; I really don't understand why we should special case
> ->exit_state. Why not DTRT and optimize NOFREEZE if all this really
> matters (smalls gains from what ISTR from the previous discussion).

The main reason we didn’t rely directly on PF_NOFREEZE is that it’s a 
mutable flag — in some cases, it can be cleared later, which makes early 
skipping potentially unsafe.

In contrast, exit_state is stable and skipping tasks based on it is safe.


Also, the previous version of the patch you shared might allow some 
paths to bypass lock_system_sleep(), which could break the intended 
protection.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ