From: Chris Friesen <chris.friesen@windriver.com>
To: cgroups@vger.kernel.org, lizefan@huawei.com
Subject: unexpected behaviour of cgroups v1 on 6.12 kernel
Date: Fri, 22 Aug 2025 13:31:38 -0600 [thread overview]
Message-ID: <f5a182a3-ca68-4917-b232-721445fbc928@windriver.com> (raw)
Hi all,
I'm not subscribed to the list, so please CC me on replies.
I'm seeing some unexpected behaviour with the cpu/cpuset cgroups
controllers (with cgroups v1) on 6.12.18 with PREEMPT_RT enabled.
I set up the following cgroup hierarchy for both cpu and cpuset cgroups:
foo: cpu 15, shares 1024
foo/a: cpu 15, shares 1024
bar: cpu 15-19, shares 1024
bar/a: cpu 15, shares 1024
bar/b: cpu 16, shares 1024
bar/c: cpu 17, shares 1024
bar/d: cpu 18, shares 1024
bar/e: cpu 19, shares 1024
I then ran a single cpu hog in each of the leaf-node cgroups in the
default SCHED_OTHER class.
As expected, the tasks in bar/b, bar/c, bar/d, and bar/e each got 100%
of their CPU. What I didn't expect was that the task running in foo/a
got 83.3%, while the task in bar/a got 16.7%. Is this expected?
I guess what I'm asking here is whether the cgroups CPU share
calculation is supposed to be performed separately per CPU, or whether
it's global but somehow scaled by the number of CPUs that the cgroup is
runnable on, so that the total CPU time of group "bar" is expected to be
5x the total CPU time of group "foo".
I then killed all the tasks in bar/b, bar/c, bar/d, and bar/e. The
tasks in foo/a and bar/a continued for a while at 83/16, then moved to
80/20, and only about 75 seconds later finally moved to 50/50. Is
this long time to "rebalance" expected? If so, can this time be
modified by the admin user at runtime or is it inherent in the code?
As further data, if I have tasks in foo/a, bar/a, bar/b, bar/c then
foo/a gets 75%, bar/a gets 25%, bar/b and bar/c both get 100%.
If I have tasks in foo/a, bar/a, bar/b then foo/a gets 66%, bar/a gets
33%, bar/b gets 100%. (But it started out with foo/a getting 75% and
switched 10s of seconds later, which seems odd.)
Thanks,
Chris
next reply other threads:[~2025-08-22 19:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 19:31 Chris Friesen [this message]
2025-08-23 0:57 ` unexpected behaviour of cgroups v1 on 6.12 kernel Chen Ridong
2025-08-27 17:16 ` Chris Friesen
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=f5a182a3-ca68-4917-b232-721445fbc928@windriver.com \
--to=chris.friesen@windriver.com \
--cc=cgroups@vger.kernel.org \
--cc=lizefan@huawei.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;
as well as URLs for NNTP newsgroup(s).