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

From: Ridong Chen

Date: Sat Nov 07 2026 - 07:04:54 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 v3:
- Patch 3: merge isolated_cpus_set_state() into isolated_cpus_update(),
dropping its @old_prs argument and the WARN_ON_ONCE(), and drop the
state check in partition_xcpus_add() (Waiman).
Drop the Acked-by from Guopeng as the patch changed.
- Patch 4: use top_cpuset as the parent of a remote partition and pass
the parent to tasks_nocpu_error() instead of parent_cs(cs) (Waiman).

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 | 236 +++++++-----------
.../selftests/cgroup/test_cpuset_prs.sh | 6 +
2 files changed, 100 insertions(+), 142 deletions(-)


base-commit: 8b7179210b22f8e48a82c5ceacb9d56a9c4cfec4
--
2.34.1