[PATCH v2 0/4] cpuset: preparatory fixes and cleanups for partition rework

From: Ridong Chen

Date: Fri Nov 06 2026 - 06:05:08 EST


From: Ridong Chen <chenridong@xxxxxxxxxx>

This is the first part of the cpuset local partition rework posted as
RFC v4 [1]. The rework is split into three parts to make it easier to
review and merge:

1) fixes and preparatory cleanups (this series);
2) introduce partition_enable/disable/update() and rework the local
partition code on top of them;
3) clean up the remaining partition state handling outside these
helpers.

Patch 1 is a fix for an existing bug, found while looking into a review
comment on RFC v4: when cpuset.cpus.exclusive of an already invalid
partition root is cleared, its effective_xcpus is not reset, so its
former exclusive CPUs can't be claimed by a sibling. A test case is
added for it.

Patches 2-4 are the first three patches of RFC v4, rebased onto
next-20261104:

2) add an early empty cpumask check in partition_xcpus_add/del(), so
callers don't need to check it;
3) settle the isolation state of CPUs given back to the parent in
partition_xcpus_del(), so isolated_cpus_release() can be removed;
4) generalize validate_partition() so it can be used for both local
and remote partitions.

All patches build on their own, and test_cpuset_prs.sh passes with
this series applied.

[1] https://lore.kernel.org/all/20261101114206.2434398-1-ridong.chen@xxxxxxxxx/

Changes in v2:
- Patch 1: force update_cpumasks_hier() after reset_partition_data(),
so that the descendants don't keep the released exclusive CPUs, and
add a test case for it (Sashiko).
- Patch 1: fix the Fixes tags (Sashiko).
- Link to v1: https://lore.kernel.org/all/20261105125215.2205892-1-ridong.chen@xxxxxxxxx/

Changes since RFC v4:
- New patch 1 to fix the invalid partition effective_xcpus reset.
- Patch 3: only settle the isolation state of the CPUs still owned by
the parent when invalidating a child partition in
compute_partition_effective_cpumask(), as the parent may be shrunk
and not updated yet. This code is removed later in the rework.
- Rebase onto next-20261104, which includes commit 362212853cd0
("cgroup/cpuset: Fix incorrect CPU accounting with parent's effective_xcpus expansion").



Chen Ridong (2):
cpuset: add early empty cpumask check in partition_xcpus_add/del
cpuset: generalize the validate_partition() interface

Ridong Chen (2):
cgroup/cpuset: Reset partition data when an invalid partition stays
invalid
cpuset: settle isolation state when CPUs are given back to parent

kernel/cgroup/cpuset.c | 217 ++++++++----------
.../selftests/cgroup/test_cpuset_prs.sh | 6 +
2 files changed, 97 insertions(+), 126 deletions(-)


base-commit: 8b7179210b22f8e48a82c5ceacb9d56a9c4cfec4
--
2.34.1