[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <67997bdd-d00a-413a-a565-188c4b06f385@kylinos.cn>
Date: Fri, 4 Jul 2025 16:48:20 +0800
From: Zihuan Zhang <zhangzihuan@...inos.cn>
To: Peter Zijlstra <peterz@...radead.org>,
"Rafael J. Wysocki" <rafael@...nel.org>
Cc: pavel@...nel.org, len.brown@...el.com, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, Oleg Nesterov <oleg@...hat.com>
Subject: Re: [PATCH v3 1/1] PM / Freezer: Skip zombie/dead processes to
Hi Peter,
Thanks for the feedback.
在 2025/7/4 16:19, Peter Zijlstra 写道:
>
> Depending on where they wait (I can't seem to find in a hurry) it might
> make sense to make that wait FREEZABLE anyway.
>
> For example, AFAICT it wouldn't hurt, and might even help some, to make
> kernel/exit.c:do_wait() TASK_FREEZABLE.
>
> So where do ZOMBIEs sleep? Don't they simply pass through do_task_dead()
> and never get scheduled again? Notably, do_task_dead() already marks the
> tasks as PF_NOFREEZE.
>
> Anyway, yes, the condition it adds is relatively simple, but I really
> don't see why we should complicate things *at*all*.
You’re absolutely right — zombie processes won’t be frozen in practice,
since PF_NOFREEZE is already set in do_task_dead(). However, if we don’t
explicitly skip them early in try_to_freeze_task(), they still go
through the freezer logic path, including calls like freeze_task() →
freezing() before eventually returning without freezing.
This not only introduces unnecessary code path traversal, but also
involves locking (e.g., spin_lock_irqsave/restore()), which could be
avoided altogether if we bail out earlier.
Additionally, skipping zombies directly helps reduce the list traversal
overhead in freeze_processes(), especially on systems with a large
number of tasks, where zombies can account for a non-trivial fraction.
So while the practical effect might be small, the gain is low-risk and
helps streamline the freezer logic a bit more.
Powered by blists - more mailing lists