From: Tejun Heo <tj@kernel.org>
To: "Michal Koutný" <mkoutny@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH cgroup/for-6.18-fixes] cgroup: Skip showing PID 0 in cgroup.procs and cgroup.threads
Date: Tue, 11 Nov 2025 10:57:32 -1000 [thread overview]
Message-ID: <aROjPBLaJVSrNRvN@slm.duckdns.org> (raw)
In-Reply-To: <aQ31cwAFCS4Tvb7T@slm.duckdns.org>
On Fri, Nov 07, 2025 at 03:34:43AM -1000, Tejun Heo wrote:
> Hello,
>
> On Fri, Nov 07, 2025 at 10:57:54AM +0100, Michal Koutný wrote:
> > On Thu, Nov 06, 2025 at 12:07:45PM -1000, Tejun Heo <tj@kernel.org> wrote:
> > > css_task_iter_next() pins and returns a task, but the task can do whatever
> > > between that and cgroup_procs_show() being called, including dying and
> > > losing its PID. When that happens, task_pid_vnr() returns 0.
> >
> > task_pid_vnr() would return 0 also when the process is not from reader's
> > pidns (IMO more common than the transitional effect).
>
> Hmm... haven't thought about that.
>
> > > Showing "0" in cgroup.procs or cgroup.threads is confusing and can lead to
> > > surprising outcomes. For example, if a user tries to kill PID 0, it kills
> > > all processes in the current process group.
> >
> > It's still info about present processes.
> >
> > >
> > > Skip entries with PID 0 by returning SEQ_SKIP.
> >
> > It's likely OK to skip for these exiting tasks but with the external pidns tasks
> > in mind, reading cgroup.procs now may give false impression of an empty
> > cgroup.
> >
> > Where does the 0 from of the exiting come from? (Could it be
> > distinguished from foreign pidns?)
>
> Yeah, I think it can be distinguished. We just need to check whether the
> task has pid attached at all after getting 0 return from task_pid_vnr().
Let me drop this patch for now.
Thanks.
--
tejun
prev parent reply other threads:[~2025-11-11 20:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 22:07 [PATCH cgroup/for-6.18-fixes] cgroup: Skip showing PID 0 in cgroup.procs and cgroup.threads Tejun Heo
2025-11-06 22:17 ` Tejun Heo
2025-11-07 9:57 ` Michal Koutný
2025-11-07 13:34 ` Tejun Heo
2025-11-11 20:57 ` Tejun Heo [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=aROjPBLaJVSrNRvN@slm.duckdns.org \
--to=tj@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkoutny@suse.com \
--cc=stable@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox