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-next>] [day] [month] [year] [list]
Message-Id: <20250523034253.88083-1-zhangzihuan@kylinos.cn>
Date: Fri, 23 May 2025 11:42:53 +0800
From: Zihuan Zhang <zhangzihuan@...inos.cn>
To: rafael@...nel.org,
	len.brown@...el.com,
	pavel@...nel.org
Cc: linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Zihuan Zhang <zhangzihuan@...inos.cn>
Subject: [PATCH v2] PM / Freezer: Skip dead/zombie processes

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++;
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ