All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Zihuan Zhang <zhangzihuan@kylinos.cn>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	pavel@kernel.org, len.brown@intel.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/1] PM / Freezer: Skip zombie/dead processes to
Date: Wed, 16 Jul 2025 18:16:24 +0200	[thread overview]
Message-ID: <20250716161624.GD16401@redhat.com> (raw)
In-Reply-To: <20250707084214.GD1613200@noisy.programming.kicks-ass.net>

I don't like the patch Zihuan, but

On 07/07, Peter Zijlstra wrote:
>
> Anyway, this seems to suggest something relatively simple like this here
> should do:
>
> diff --git a/kernel/freezer.c b/kernel/freezer.c
> index 8d530d0949ff..8b7cecd17564 100644
> --- a/kernel/freezer.c
> +++ b/kernel/freezer.c
> @@ -162,20 +162,22 @@ static bool __freeze_task(struct task_struct *p)
>   */
>  bool freeze_task(struct task_struct *p)
>  {
> -	unsigned long flags;
> -
> -	spin_lock_irqsave(&freezer_lock, flags);
> -	if (!freezing(p) || frozen(p) || __freeze_task(p)) {
> -		spin_unlock_irqrestore(&freezer_lock, flags);
> +	/*
> +	 * User tasks get NOFREEZE in do_task_dead().
> +	 */
> +	if ((p->flags & (PF_NOFREEZE | PF_KTHREAD)) == PF_NOFREEZE)
>  		return false;
> -	}

I don't understand your change...

It probably makes sense to avoid freezer_lock when PF_NOFREEZE is set but
it can't change the current behaciour, freezing() -> freezing_slow_path()
checks PF_NOFREEZE too and returns false in this case.

Oleg.


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

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-11 10:12 [PATCH v3 0/1] PM / Freezer: Skip zombie/dead processes to reduce Zihuan Zhang
2025-06-11 10:12 ` [PATCH v3 1/1] PM / Freezer: Skip zombie/dead processes to Zihuan Zhang
2025-07-03 14:15   ` Rafael J. Wysocki
2025-07-03 16:40     ` Peter Zijlstra
2025-07-03 17:15       ` Rafael J. Wysocki
2025-07-04  1:45         ` Zihuan Zhang
2025-07-04  8:19         ` Peter Zijlstra
2025-07-04  8:48           ` Zihuan Zhang
2025-07-04  9:21             ` Peter Zijlstra
2025-07-07  1:00               ` Zihuan Zhang
2025-07-07  8:42                 ` Peter Zijlstra
2025-07-08  0:56                   ` Zihuan Zhang
2025-07-16 16:16                   ` Oleg Nesterov [this message]

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=20250716161624.GD16401@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.