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] [day] [month] [year] [list]
Message-ID: <CAJZ5v0j7i1zbcR7Tv4zNDzR8__keq3bV2m1BZJCS0-cxT8Da4Q@mail.gmail.com>
Date: Fri, 23 May 2025 17:14:18 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Zihuan Zhang <zhangzihuan@...inos.cn>
Cc: rafael@...nel.org, len.brown@...el.com, pavel@...nel.org, 
	linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] PM / Freezer: Skip dead/zombie processes

On Fri, May 23, 2025 at 5:44 AM Zihuan Zhang <zhangzihuan@...inos.cn> wrote:
>
> ZOMBIE (exit_state == EXIT_ZOMBIE) and DEAD (exit_state == EXIT_DEAD)
> processes have already finished execution and will not be scheduled again.
>
> In the context of system suspend (e.g., S3), attempting to freeze such
> processes is unnecessary. Moreover, freezing them can obscure suspend
> diagnostics and delay resume if they appear "stuck" in logs.
>
> This patch introduces an early check for `p->exit_state != 0` in
> `try_to_freeze_tasks()` and skips freezing for such tasks. This is a safe
> optimization because:
>
>  - They hold no running resources
>  - Their `task_struct` is only waiting to be collected or freed
>
> Signed-off-by: Zihuan Zhang <zhangzihuan@...inos.cn>
>
> Changes in v2:
> - Simplified code, added judgment of dead processes
> - Rewrite changelogs
> ---
>  kernel/power/process.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/power/process.c b/kernel/power/process.c
> index 66ac067d9ae6..82528a79d46a 100644
> --- a/kernel/power/process.c
> +++ b/kernel/power/process.c
> @@ -51,7 +51,7 @@ 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))
> +                       if (p == current || p->exit_state || !freeze_task(p))
>                                 continue;
>
>                         todo++;
> --

This is a bit too late for 6.16, please resubmit when 6.16-rc1 is out.

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ