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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6ab5e858-c0bd-4cb0-b1f8-b95c452c6b6b@kylinos.cn>
Date: Thu, 17 Jul 2025 16:45:48 +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 09:31, Oleg Nesterov 写道:
> Hi Zihuan,
>
> On 07/17, Zihuan Zhang wrote:
>>>> +			 */
>>>> +			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,
> How so? please look at do_exit(). The exiting task is still running
> until it does its last __schedule() in do_task_dead().
>
To verify the potential presence of EXIT_DEAD tasks during the freezing 
stage, I added some logging in try_to_freeze_tasks() to print out any 
task with exit_state == EXIT_DEAD. Then I created a fork storm scenario 
to ensure a large number of tasks are exiting during the freeze window.

In practice, even after running hundreds of iterations under heavy load, 
I wasn’t able to capture any such task being printed. Since the exit 
phase is very fast, it seems unlikely that an EXIT_DEAD task stays in 
the process list long enough to be observed during the freeze loop.

So I believe it's safe to skip tasks with exit_state  in this context.

diff --git a/kernel/power/process.c b/kernel/power/process.c
index c1d6c5150033..054fad43ed31 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -59,6 +59,8 @@ static int try_to_freeze_tasks(bool user_only)
                          * a more generic exclusion mechanism for other 
non-freezable tasks.
                          * However, for now, exit_state is sufficient 
to skip user processes.
                          */
+                      if (p->exit_state == EXIT_DEAD)
+                               pr_info("current process is going to 
dead name:%s pid:%d  \n", p->comm, p->pid);
                         if (p == current || p->exit_state || 
!freeze_task(p))
                                 continue;

>> 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