From: Tejun Heo <tj@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: "Michal Koutný" <mkoutny@suse.com>,
cgroups@vger.kernel.org, linux-rt-devel@lists.linux.dev,
"Ben Segall" <bsegall@google.com>,
"Clark Williams" <clrkwllms@kernel.org>,
"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
"Ingo Molnar" <mingo@redhat.com>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Juri Lelli" <juri.lelli@redhat.com>,
"Mel Gorman" <mgorman@suse.de>,
"Peter Zijlstra" <peterz@infradead.org>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Valentin Schneider" <vschneid@redhat.com>,
"Vincent Guittot" <vincent.guittot@linaro.org>
Subject: Re: [PATCH] cgroup: Move cgroup_task_dead() to task_struct clean up
Date: Sun, 15 Mar 2026 10:15:41 -1000 [thread overview]
Message-ID: <abcTbSznpQ1qxJdj@slm.duckdns.org> (raw)
In-Reply-To: <20260314091752.B7CXvQxn@linutronix.de>
Hello,
On Sat, Mar 14, 2026 at 10:17:52AM +0100, Sebastian Andrzej Siewior wrote:
> On 2026-03-13 18:33:14 [+0100], Michal Koutný wrote:
> > Hello.
> >
> > On Wed, Mar 11, 2026 at 01:08:29PM +0100, Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> > > @@ -7084,6 +7031,7 @@ void cgroup_task_free(struct task_struct *task)
> > > {
> > > struct css_set *cset = task_css_set(task);
> > >
> > > + cgroup_task_dead(task);
> > > if (!list_empty(&task->cg_list)) {
> > > spin_lock_irq(&css_set_lock);
> > > css_set_skip_task_iters(task_css_set(task), task);
> >
> > Erm, isn't this way too late?
>
> My understanding is that the point is that the cgroup must not be
> exposed to userland once the task is about to die. This has been moved
> after the fine schedule() which is too late because the parent is
> signaled before that and the removal happens after that.
> So now we hide the tasks in the iterator once the task is PF_EXITING.
Yeah, I think it's too late. That's where we tell the cgroup is becoming
empty among other things. cgroup_task_free() waits for all task refcnts to
drop which can take any amount of time. You can also imagine situations
where e.g. userspace pins a specific task through pidfd unitl the cgroup it
belongs becomes empty, which would have worked before but now would
deadlock.
Thanks.
--
tejun
next prev parent reply other threads:[~2026-03-15 20:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 12:08 [PATCH] cgroup: Move cgroup_task_dead() to task_struct clean up Sebastian Andrzej Siewior
2026-03-13 17:33 ` Michal Koutný
2026-03-14 9:17 ` Sebastian Andrzej Siewior
2026-03-15 20:15 ` Tejun Heo [this message]
2026-03-16 8:06 ` Sebastian Andrzej Siewior
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=abcTbSznpQ1qxJdj@slm.duckdns.org \
--to=tj@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=bsegall@google.com \
--cc=cgroups@vger.kernel.org \
--cc=clrkwllms@kernel.org \
--cc=dietmar.eggemann@arm.com \
--cc=hannes@cmpxchg.org \
--cc=juri.lelli@redhat.com \
--cc=linux-rt-devel@lists.linux.dev \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=mkoutny@suse.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/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