All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Chen Ridong <chenridong@huaweicloud.com>
Cc: timvp@google.com, Michal Koutn?? <mkoutny@suse.com>,
	rafael@kernel.org, pavel@kernel.org, tj@kernel.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	lujialin4@huawei.com, chenridong@huawei.com
Subject: Re: [PATCH next] sched,freezer: prevent tasks from escaping being frozen
Date: Tue, 8 Jul 2025 09:28:52 +0200	[thread overview]
Message-ID: <20250708072852.GD1613376@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <c63a1698-2d93-4105-8641-ecec69b48523@huaweicloud.com>

On Mon, Jul 07, 2025 at 07:32:59PM +0800, Chen Ridong wrote:

> Below is the race condition scenario:
> 
> get_signal				read freezer.state
> try_to_freeze
> __refrigerator				freezer_read
> 					update_if_frozen
> WRITE_ONCE(current->__state, TASK_FROZEN);			
> 					// The task is set to frozen(now, frozen(task) == ture).
> 					// we suppose other tasks are all frozen.
> 					// set cgroup frozen when all tasks are frozen
> 					freezer->state |= CGROUP_FROZEN;

Ooh, yes, now I see. Somehow I kept missing update_if_frozen().
Sometimes reading is hard :-) Thanks!

> // freezing(current) will return false,
> // since cgroup is frozen(not freezing)
> break out
> __set_current_state(TASK_RUNNING);
> //bug: the task is set to running, but it should be frozen.

  reply	other threads:[~2025-07-08  7:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-03 13:34 [PATCH next] sched,freezer: prevent tasks from escaping being frozen Chen Ridong
2025-07-03 17:01 ` Michal Koutný
2025-07-04  3:02   ` Chen Ridong
2025-07-04  3:11     ` Chen Ridong
2025-07-04  7:57       ` Peter Zijlstra
2025-07-04 10:25         ` Chen Ridong
2025-07-07  4:02           ` Chen Ridong
2025-07-07 10:10             ` Peter Zijlstra
2025-07-07 11:32               ` Chen Ridong
2025-07-08  7:28                 ` Peter Zijlstra [this message]
2025-07-08 15:35                   ` Tim Van Patten
2025-07-10 15:44             ` Michal Koutný
2025-07-11  0:51               ` Chen Ridong
2025-07-07 16:38     ` Michal Koutný
2025-07-08  1:38       ` Chen Ridong

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=20250708072852.GD1613376@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=chenridong@huawei.com \
    --cc=chenridong@huaweicloud.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lujialin4@huawei.com \
    --cc=mkoutny@suse.com \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    --cc=timvp@google.com \
    --cc=tj@kernel.org \
    /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.