[PATCH v2 0/6] cgroup/cpuset: Fix partition type transitions

From: Guopeng Zhang

Date: Fri Aug 28 2026 - 05:59:35 EST


From: Guopeng Zhang <zhangguopeng@xxxxxxxxxx>

Several partition type-change and validation paths use effective_xcpus,
which also includes CPUs assigned to valid child partitions. This can
change a child's isolation accounting, make a valid parent transition
fail housekeeping validation or invalidate a parent during a later
CPU-mask update.

Once type-change checks are limited to CPUs owned by the parent, a root
child can hold the last housekeeping CPU while its parent is isolated.
Returning that CPU when the child becomes a member must not consume the
last housekeeping CPU.

A type change that fails housekeeping validation can also leave CPUs
allocated to the invalid partition instead of returning them to the
partition which owns the invalidated subtree.

Use CPUs owned directly by a partition for type-change accounting and
validation. Recheck the housekeeping constraint when child CPUs return,
and release partition CPUs after failed type-change validation. Add
focused selftests for each case.

This is based on cgroup/for-7.3-fixes (87d347a8c854 "selftests/cgroup:
Add test for preserving boot-isolated CPUs").

Testing:
- Ran tools/testing/selftests/cgroup/test_cpuset_prs.sh with
isolcpus=domain,15; all applicable tests passed.
- Ran the housekeeping CPU-return tests with
nohz_full=1-14 isolcpus=domain,15; both cases passed.
- Ran targeted A/B tests covering child-owned CPU accounting and
validation, housekeeping CPU return, and CPU release after local and
remote type-change validation failures.

Changes in v2:
- split the type-transition fixes from the original series;
- merge the child-owned accounting and validation changes;
- validate trial CPU masks against CPUs owned directly by the partition;
- handle a root child returning the last housekeeping CPU, including
nested isolated ancestors;
- use the common partition-disable path after type-change validation
failure;
- initialize boot-isolated CPU data during selftest setup;
- split the accounting, child-owned validation and housekeeping-return
tests.

Link: https://lore.kernel.org/all/20260820124202.517160-1-guopeng.zhang@xxxxxxxxx/

Guopeng Zhang (6):
cgroup/cpuset: Respect child CPU ownership in type changes
selftests/cgroup: Add tests for type-change isolation accounting
selftests/cgroup: Add tests for type changes with child-owned CPUs
selftests/cgroup: Add tests for housekeeping CPU return to isolated
parents
cgroup/cpuset: Release CPUs when type-change validation fails
selftests/cgroup: Add CPU release tests for type-change validation
failures

kernel/cgroup/cpuset.c | 101 +++++-
.../selftests/cgroup/test_cpuset_prs.sh | 310 +++++++++++++++++-
2 files changed, 398 insertions(+), 13 deletions(-)


base-commit: 87d347a8c8545a9234d1dd215023064413284c34
--
2.43.0