diff options
| author | Ridong Chen <chenridong@xiaomi.com> | 2026-11-12 11:19:30 +0800 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-11-13 09:23:28 -1000 |
| commit | c1ad01173511e8aec378af9f5285f98b767b1381 (patch) | |
| tree | 40e2dd32aac51f31dcaed20b0b7eebc51da4631d /scripts/diffconfig | |
| parent | 56681bc448a80bb2473026b41c44c133766bc38d (diff) | |
cpuset: settle isolation state when CPUs are given back to parent
partition_xcpus_del() only updates isolated_cpus when the partition that
gives back the CPUs has a different state than its parent. CPUs that were
further distributed to descendant isolated partitions are not taken into
account, so isolated_cpus_release() has to be called afterwards in
several places to walk up the ancestors and fix isolated_cpus.
This misses some cases and leaks isolated CPUs, as reported by Guopeng.
An isolated partition can be invalidated after its parent has already
become invalid, and its CPUs are left in isolated_cpus. For example, on a
32-CPU system with all CPUs online and without isolcpus= or nohz_full=
boot parameters:
cd /sys/fs/cgroup
echo +cpuset > cgroup.subtree_control
mkdir A
echo 0,2-31 > A/cpuset.cpus
echo root > A/cpuset.cpus.partition
echo +cpuset > A/cgroup.subtree_control
mkdir A/B
echo 2-3 > A/B/cpuset.cpus
echo isolated > A/B/cpuset.cpus.partition
cat cpuset.cpus.isolated
2-3
echo 0 > /sys/devices/system/cpu/cpu1/online
cat A/B/cpuset.cpus.partition
isolated invalid
cat cpuset.cpus.isolated
2-3
When A is invalidated, partition_xcpus_del() gives CPUs 0,2-31 back to
top cpuset. Both A and top cpuset are root partitions, so isolated_cpus
is left untouched although CPUs 2-3 were distributed to the isolated B.
B is then invalidated with an invalid parent, and nothing releases CPUs
2-3 either.
Make partition_xcpus_del() always set the isolation state of the given
back CPUs to the state of the parent that receives them. As the
effective_xcpus of a partition covers the CPUs distributed to its
descendants, the isolation state of those CPUs is settled at the same
time. Boot-time isolated CPUs are still preserved by isolated_cpu_update().
compute_partition_effective_cpumask() invalidates a child partition
without going through partition_xcpus_del(), so do the same there: the
CPUs of the invalidated child take the isolation state of its parent.
As the parent may be shrunk and its effective_xcpus not updated yet,
only do so for the CPUs the parent still owns. This is to keep the
isolation state correct for now, the in-place invalidation here will be
removed later in the partition rework.
isolated_cpus_update() assumes the old and new states are different,
which no longer holds now that partition_xcpus_del() proceeds regardless
of the states. Drop its @old_prs argument and the WARN_ON_ONCE() so that
it simply sets the isolation state of the given CPUs, and use it
everywhere. The state check in partition_xcpus_add() is dropped as well,
as setting the state is a no-op when the states are the same.
isolated_cpus_release() is no longer needed and is removed.
Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated partitions")
Reported-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Closes: https://lore.kernel.org/all/20261105130344.664336-4-guopeng.zhang@linux.dev/
Signed-off-by: Ridong Chen <chenridong@xiaomi.com>
Reviewed-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/diffconfig')
0 files changed, 0 insertions, 0 deletions
