From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: mtk.manpages@gmail.com,
"open list:CONTROL GROUP (CGROUP)" <cgroups@vger.kernel.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Cgroups v2 bug: incorrect reporting in "domain threaded" cgroup.procs file
Date: Wed, 7 Nov 2018 20:46:30 +0100 [thread overview]
Message-ID: <fdb057a2-342a-d49e-587a-f1ca8680033e@gmail.com> (raw)
Hello Tejun,
I've discovered what looks to be a bug in the reporting
of PIDs in the cgroup.procs file in the "domain threaded"
node at the root of a threaded subtree. The following
demo is on vanilla kernel 4.19.
Suppose we have the following multithreaded process:
$ ps -L 654
PID LWP TTY STAT TIME COMMAND
654 654 pts/12 Tl 0:00 ./cpu_multithread_burner 100
654 655 pts/12 Tl 0:01 ./cpu_multithread_burner 100
Now suppose we create a threaded subtree in the v2 hierarchy:
# cd /sys/fs/cgroup/unified/
# mkdir -p x/a/b
# echo 'threaded' > x/a/cgroup.type
# echo 'threaded' > x/a/b/cgroup.type
Then we move the multithreaded process into x/a in
the threaded subtree:
# echo 654 > x/a/cgroup.procs
Now we visualize the set-up using my visualization
program[1]:
# go run ~mtk/lsp/cgroups/view_v2_cgroups.go x
x [dt]
PIDs: {654}
a [t]
TIDs: {654 655-[654]}
b [t]
The above is as I expect.
Now, we move the thread group leader (it has to be the
thread group leader to show the bug) to a x/a/b, and again
use my visualization program:
# echo 654 > x/a/b/cgroup.threads
# go run ~mtk/lsp/cgroups/view_v2_cgroups.go x
x [dt]
PIDs: {654 655}
a [t]
TIDs: {655-[654]}
b [t]
TIDs: {654}
Note how the *thread ID* of the non-thread-group-leader
(655) is being reported in the x/cgroup.procs!
And just to verify that this is not a bug in my
visualization program:
# cat x/cgroup.procs
655
654
Your thoughts?
Thanks,
Michael
[1] https://www.spinics.net/lists/cgroups/msg20710.html
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
next reply other threads:[~2018-11-07 19:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-07 19:46 Michael Kerrisk (man-pages) [this message]
2018-11-08 20:15 ` [PATCH for-4.20-fixes] cgroup: fix CSS_TASK_ITER_PROCS Tejun Heo
2018-11-20 16:13 ` Tejun Heo
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=fdb057a2-342a-d49e-587a-f1ca8680033e@gmail.com \
--to=mtk.manpages@gmail.com \
--cc=cgroups@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®