mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Zihuan Zhang <zhangzihuan@kylinos.cn>
Cc: "rafael J . wysocki" <rafael@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	len brown <len.brown@intel.com>, pavel machek <pavel@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] PM / Freezer: Skip zombie/dead processes to reduce freeze latency
Date: Wed, 16 Jul 2025 18:38:55 +0200	[thread overview]
Message-ID: <20250716163854.GE16401@redhat.com> (raw)
In-Reply-To: <20250716062639.1528066-2-zhangzihuan@kylinos.cn>

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.

> +			 */
> +			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() ?

Oleg.


  reply	other threads:[~2025-07-16 16:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-16  6:26 [PATCH v4 0/1] PM / Freezer: Skip zombie/dead processes to reduce Zihuan Zhang
2025-07-16  6:26 ` [PATCH v4] PM / Freezer: Skip zombie/dead processes to reduce freeze latency Zihuan Zhang
2025-07-16 16:38   ` Oleg Nesterov [this message]
2025-07-16 18:36     ` Peter Zijlstra
2025-07-17  1:30       ` Zihuan Zhang
2025-07-17  1:43         ` Oleg Nesterov
2025-07-17  1:16     ` Zihuan Zhang
2025-07-17  1:31       ` Oleg Nesterov
2025-07-17  8:45         ` Zihuan Zhang
2025-07-16 12:26 ` [PATCH v4 0/1] PM / Freezer: Skip zombie/dead processes to reduce Rafael J. Wysocki
2025-07-17  1:02   ` Zihuan Zhang
2025-07-17  9:50     ` Rafael J. Wysocki
2025-07-21 10:39       ` Zihuan Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250716163854.GE16401@redhat.com \
    --to=oleg@redhat.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=zhangzihuan@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®