Skip to content

cgroup/cpuset: fix exclusive CPU conflict checks for local and remote partitions

Hui Peng cgroups linux-kselftest lkml stable 3 versions – Applied

Status from this message: Applied to cgroup/for-7.3-fixes with the subject capitalized and the

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 8 repliesApplied
  2. v33 patches 4 repliesSuperseded
  3. v22 patches 2 repliesSuperseded

Changes in v4 from the cover letter

- Send as a standalone series with a cover letter (0/3) instead of replying in-thread to the previous version, as requested by Ridong Chen and Waiman Long.
- Restore the exact v2 diff and commit description for patch 1/3 (which was accidentally corrupted when splitting v2 into 3 patches in v3), fixing git apply against mainline.
- Make the test_cpuset_prs.sh test case in patch 2/3 independent of the system CPU count (using X2-3 / CX2-3:P2 / P1:CX1-3 instead of CX0-7:P1), as pointed out by Waiman Long.

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/3cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() on subpartitions_cpus conflictkernel/cgroup/cpuset.c tools/testing/selftests/cgroup/test_cpuset_prs.sh+4 -13 replies
2/3cgroup/cpuset: prevent activating local partition over remote onekernel/cgroup/cpuset.c tools/testing/selftests/cgroup/test_cpuset_prs.sh+6 -03 replies
3/3cgroup/cpuset: check sibling effective_xcpus in cpus_excl_conflict()kernel/cgroup/cpuset.c tools/testing/selftests/cgroup/test_cpuset_prs.sh+5 -12 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchWaiman LongRidong Chen
1/3R-b R-b R-b
2/3
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/3] cgroup/cpuset: fix exclusive CPU conflict checks for local and remote partitions

This series fixes three exclusive CPU validation gaps across local and remote partitions in kernel/cgroup/cpuset.c and adds corresponding regression tests to tools/testing/selftests/cgroup/test_cpuset_prs.sh:

1. Patch 1/3 ("cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() on subpartitions_cpus conflict"):
Restores the subpartitions_cpus conflict error check in remote_partition_enable() (returning PERR_NOCPUS to match remote_cpus_update()) so a remote partition cannot be enabled underneath an ancestor local partition via a non-partition intermediate cgroup.

2. Patch 2/3 ("cgroup/cpuset: prevent activating local partition over remote one"):
Checks trialcs->exclusive_cpus against subpartitions_cpus in validate_partition() when !is_partition_valid(cs) so an initially invalid top-level partition cannot later transition to a valid local partition over an active remote partition via cpuset.cpus / cpuset.cpus.exclusive updates.

3. Patch 3/3 ("cgroup/cpuset: check sibling effective_xcpus in cpus_excl_conflict()"):
Falls back to sibling->effective_xcpus in cpus_excl_conflict() when sibling->exclusive_cpus is empty so a sibling cgroup cannot claim cpuset.cpus.exclusive over a valid local partition's implicit exclusive CPUs.

Changes in v4:
- Send as a standalone series with a cover letter (0/3) instead of replying in-thread to the previous version, as requested by Ridong Chen and Waiman Long.
- Restore the exact v2 diff and commit description for patch 1/3 (which was accidentally corrupted when splitting v2 into 3 patches in v3), fixing git apply against mainline.
- Make the test_cpuset_prs.sh test case in patch 2/3 independent of the system CPU count (using X2-3 / CX2-3:P2 / P1:CX1-3 instead of CX0-7:P1), as pointed out by Waiman Long.

Changes in v3:
- Split patch 2/2 from v2 into patch 2/3 (validate_partition(),

Fixes 6da580ec656a) and patch 3/3 (cpus_excl_conflict(),
Fixes 2a3602030d80), as pointed out by Guopeng Zhang.

- Add Assisted-by: LLM tag.

Changes in v2:
- Split the remote_partition_enable() fix into patch 1/2 and return PERR_NOCPUS instead of PERR_INVCPUS to match remote_cpus_update(), as suggested by Guopeng Zhang.
- Add step-by-step reproducer and test_cpuset_prs.sh regression tests, as requested by Ridong Chen.

Hui Peng (3):
cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() on subpartitions_cpus conflict cgroup/cpuset: prevent activating local partition over remote one cgroup/cpuset: check sibling effective_xcpus in cpus_excl_conflict()

 kernel/cgroup/cpuset.c                            | 12 ++++++++++--
 tools/testing/selftests/cgroup/test_cpuset_prs.sh |  5 +++++
 2 files changed, 15 insertions(+), 2 deletions(-)
Signature · 1 line
2.49.0