diff options
| author | Guopeng Zhang <zhangguopeng@kylinos.cn> | 2026-10-20 21:36:15 +0800 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-10-22 03:27:05 -1000 |
| commit | f5b5cf2be574df6f25cbf1b000960340bff9a0bb (patch) | |
| tree | 9eb6f34e1ff678f20e5467bf52ad441d8de11f12 /scripts/Makefile.thinlto | |
| parent | bf6fbf46b5ff68c4eebad5aa52309eb124f4509c (diff) | |
| download | linux-next-f5b5cf2be574df6f25cbf1b000960340bff9a0bb.tar.gz linux-next-f5b5cf2be574df6f25cbf1b000960340bff9a0bb.zip | |
cgroup/cpuset: Fix task checking when enabling a partition
Creating a child partition can fail when tasks are present in its
descendants, even though the parent has no tasks of its own.
On a cgroup v2 system with CPUs 0-7 online:
cd /sys/fs/cgroup
echo +cpuset > cgroup.subtree_control
mkdir A
echo 1-2 > A/cpuset.cpus
echo root > A/cpuset.cpus.partition
echo +cpuset > A/cgroup.subtree_control
mkdir A/B
echo 1-2 > A/B/cpuset.cpus
echo +cpuset > A/B/cgroup.subtree_control
mkdir A/B/C
echo 1-2 > A/B/C/cpuset.cpus
echo $$ > A/B/C/cgroup.procs
echo root > A/B/cpuset.cpus.partition
cat A/B/cpuset.cpus.partition
root invalid (Parent unable to distribute cpu downstream)
cat A/cpuset.cpus.effective
1-2
B should be a valid root, leaving A with an empty effective CPU list.
The task in C belongs to B's partition and does not need CPUs in A.
partition_is_populated() is called with B as excluded_child, but
continue only skips B in the pre-order walk. The walk still visits C
and finds the task there, so A is considered populated.
Fix this by skipping the whole excluded subtree with
css_rightmost_descendant(), as is already done for valid child
partitions. Also add a test case to test_cpuset_prs.sh with a task in
a grandchild cpuset.
Fixes: b1bcaed1e39a ("cpuset: Treat cpusets in attaching as populated")
Cc: stable@vger.kernel.org # v6.19+
Signed-off-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Reviewed-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
