Re: [PATCH cgroup/for-6.18-fixes] cgroup: Skip showing PID 0 in cgroup.procs and cgroup.threads
From: Michal Koutný
Date: Fri Nov 07 2025 - 04:57:57 EST
Hello.
On Thu, Nov 06, 2025 at 12:07:45PM -1000, Tejun Heo <tj@xxxxxxxxxx> 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).
> 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?)
Thanks,
Michal
Attachment:
signature.asc
Description: PGP signature