* [PATCH v2 1/2] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() on subpartitions_cpus conflict
[not found] <139d9231-4723-4365-9af7-8142e6581ede@linux.dev>
@ 2026-09-20 8:23 ` Hui Peng
2026-09-20 8:23 ` [PATCH v2 2/2] cgroup/cpuset: prevent local partition activation over remote partition and sibling xcpus conflict Hui Peng
0 siblings, 1 reply; 11+ messages in thread
From: Hui Peng @ 2026-09-20 8:23 UTC (permalink / raw)
To: Tejun Heo, Johannes Weiner, Waiman Long, Ridong Chen,
Guopeng Zhang
Cc: Michal Koutny, Shuah Khan, cgroups, linux-kselftest, linux-kernel,
Hui Peng
When a remote partition is created underneath an existing local partition
via a non-partition (PRS_MEMBER) intermediate cgroup, update_prstate() sees
parent->partition_root_state == PRS_MEMBER and calls
remote_partition_enable().
Commit 86888c7bd117 ("cgroup/cpuset: Add warnings to catch inconsistency
in exclusive CPUs") replaced the cpumask_intersects(tmp->new_cpus,
subpartitions_cpus) error check in remote_partition_enable() with
WARN_ON_ONCE(). As a result, remote_partition_enable() emits a warning
and proceeds to enable the remote partition on CPUs that are already
owned by the ancestor local partition in subpartitions_cpus.
This can be reproduced on Linux 7.3.0-rc3 with:
mkdir -p /tmp/cg1
mount -t cgroup2 none /tmp/cg1
echo "+cpuset" > /tmp/cg1/cgroup.subtree_control
mkdir /tmp/cg1/A
echo 1 > /tmp/cg1/A/cpuset.cpus
echo 1 > /tmp/cg1/A/cpuset.cpus.exclusive
echo root > /tmp/cg1/A/cpuset.cpus.partition
echo "+cpuset" > /tmp/cg1/A/cgroup.subtree_control
mkdir /tmp/cg1/A/B
echo 1 > /tmp/cg1/A/B/cpuset.cpus
echo 1 > /tmp/cg1/A/B/cpuset.cpus.exclusive
echo "+cpuset" > /tmp/cg1/A/B/cgroup.subtree_control
mkdir /tmp/cg1/A/B/D
echo 1 > /tmp/cg1/A/B/D/cpuset.cpus
echo 1 > /tmp/cg1/A/B/D/cpuset.cpus.exclusive
echo root > /tmp/cg1/A/B/D/cpuset.cpus.partition
which triggers:
WARNING: kernel/cgroup/cpuset.c:1594 at remote_partition_enable+0x1c1/0x300
and leaves both /tmp/cg1/A and /tmp/cg1/A/B/D as active root partitions
claiming exclusive CPU 1.
Fix this by returning PERR_NOCPUS when tmp->new_cpus intersects
subpartitions_cpus in remote_partition_enable(), matching the error code
used by remote_cpus_update() for the same subpartitions_cpus conflict, and
add a regression test case to
tools/testing/selftests/cgroup/test_cpuset_prs.sh.
Tested in QEMU on Linux 7.3.0-rc3 using the reproducer above and
tools/testing/selftests/cgroup/test_cpuset_prs.sh.
Fixes: 86888c7bd117 ("cgroup/cpuset: Add warnings to catch inconsistency in exclusive CPUs")
Cc: stable@vger.kernel.org
Signed-off-by: Hui Peng <benquike@gmail.com>
---
Changes in v2:
- Split into a 2-patch series (1/2 for remote_partition_enable(), 2/2 for
validate_partition() and cpus_excl_conflict()).
- Return PERR_NOCPUS instead of PERR_INVCPUS when tmp->new_cpus intersects
subpartitions_cpus to match remote_cpus_update(), as suggested by
Guopeng Zhang.
- Add regression test to tools/testing/selftests/cgroup/test_cpuset_prs.sh
and include the step-by-step reproducer in the commit description as
requested by Ridong Chen.
kernel/cgroup/cpuset.c | 3 ++-
tools/testing/selftests/cgroup/test_cpuset_prs.sh | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 52eb66e3353e..7381fa8502e7 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1591,10 +1591,11 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
* above it or remote partition root underneath it is not allowed.
*/
compute_excpus(cs, tmp->new_cpus);
- WARN_ON_ONCE(cpumask_intersects(tmp->new_cpus, subpartitions_cpus));
if (!cpumask_intersects(tmp->new_cpus, cpu_active_mask) ||
cpumask_subset(top_cpuset.effective_cpus, tmp->new_cpus))
return PERR_INVCPUS;
+ if (cpumask_intersects(tmp->new_cpus, subpartitions_cpus))
+ return PERR_NOCPUS;
if (((new_prs == PRS_ISOLATED) &&
!isolated_cpus_can_update(tmp->new_cpus, NULL)) ||
prstate_housekeeping_conflict(new_prs, tmp->new_cpus))
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index 3f7e81709365..b732078bf319 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -298,6 +298,8 @@ TEST_MATRIX=(
" C0-4:X2-4 C1-4:X2-4:P2 C2-4:X4:P1 \
. . . X1 . 0 A1:0-1|A2:2-4|A3:2-4 \
A1:P0|A2:P2|A3:P-1 2-4"
+ " CX1-3:P1 CX1-3 CX1-3 . . . P1 . 0 A1:1-3|A2:1-3|A3:1-3 \
+ A1:P1|A2:P0|A3:P-1"
# Remote partition offline tests
" C0-3 C1-3 C2-3 . X2-3 X2-3 X2-3:P2:O2=0 . 0 A1:0-1|A2:1|A3:3 A1:P0|A3:P2 2-3"
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 2/2] cgroup/cpuset: prevent local partition activation over remote partition and sibling xcpus conflict
2026-09-20 8:23 ` [PATCH v2 1/2] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() on subpartitions_cpus conflict Hui Peng
@ 2026-09-20 8:23 ` Hui Peng
2026-09-20 8:57 ` Guopeng Zhang
0 siblings, 1 reply; 11+ messages in thread
From: Hui Peng @ 2026-09-20 8:23 UTC (permalink / raw)
To: Tejun Heo, Johannes Weiner, Waiman Long, Ridong Chen,
Guopeng Zhang
Cc: Michal Koutny, Shuah Khan, cgroups, linux-kselftest, linux-kernel,
Hui Peng
Commit 6da580ec656a ("cgroup/cpuset: Don't allow creation of local
partition over a remote one") added a check in update_prstate() to reject
creating a top-level local partition whose cs->exclusive_cpus intersects
subpartitions_cpus.
However, two paths still allow overlapping exclusive CPU ownership between
a top-level local partition and a remote partition or sibling:
1. If a top-level cgroup A1 has cpuset.cpus.exclusive set, is first set to
"root" while cpuset.cpus is empty (becoming "root invalid"), has a
child A1/A2 enabled as a remote partition on those exclusive CPUs, and
then receives CPUs via A1/cpuset.cpus, update_cpumasks_hier() calls
validate_partition() without going through update_prstate(). Because
validate_partition() does not check trialcs->exclusive_cpus against
subpartitions_cpus, A1 transitions from "root invalid" to a valid local
partition over the existing remote partition A1/A2 and triggers:
WARNING: kernel/cgroup/cpuset.c:1866 at update_parent_effective_cpumask+0x54a/0x8a0
2. In cpus_excl_conflict(), when a valid local partition A1 uses implicit
exclusive CPUs (cpuset.cpus set without cpuset.cpus.exclusive, so
sibling->exclusive_cpus is empty while sibling->effective_xcpus is
populated), a sibling cgroup B1 can still set cpuset.cpus.exclusive on
the same CPUs because cpus_excl_conflict() only checks
sibling->exclusive_cpus.
Fix these issues by:
- Checking trialcs->exclusive_cpus against subpartitions_cpus in
validate_partition() when !is_partition_valid(cs).
- Falling back to sibling->effective_xcpus in cpus_excl_conflict() when
sibling->exclusive_cpus is empty.
- Adding regression test cases for both paths to
tools/testing/selftests/cgroup/test_cpuset_prs.sh.
Tested in QEMU on Linux 7.3.0-rc3 using
tools/testing/selftests/cgroup/test_cpuset_prs.sh.
Fixes: 6da580ec656a ("cgroup/cpuset: Don't allow creation of local partition over a remote one")
Cc: stable@vger.kernel.org
Signed-off-by: Hui Peng <benquike@gmail.com>
---
Changes in v2:
- Split from the remote_partition_enable() fix into patch 2/2.
- Check trialcs->exclusive_cpus (rather than effective_xcpus) in
validate_partition() when !is_partition_valid(cs) so sibling local
partitions with overlapping cpuset.cpus continue to share remaining
available CPUs as expected by test_cpuset_prs.sh.
- Add regression tests to tools/testing/selftests/cgroup/test_cpuset_prs.sh.
kernel/cgroup/cpuset.c | 9 ++++++++-
tools/testing/selftests/cgroup/test_cpuset_prs.sh | 3 +++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 7381fa8502e7..f46a51f07938 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -713,7 +713,10 @@ static inline bool cpus_excl_conflict(struct cpuset *trial, struct cpuset *sibli
return true;
/* Exclusive_cpus cannot intersect */
- return cpumask_intersects(trial->exclusive_cpus, sibling->exclusive_cpus);
+ return cpumask_intersects(trial->exclusive_cpus,
+ cpumask_empty(sibling->exclusive_cpus)
+ ? sibling->effective_xcpus
+ : sibling->exclusive_cpus);
}
static inline bool mems_excl_conflict(struct cpuset *cs1, struct cpuset *cs2)
@@ -2415,6 +2418,10 @@ static enum prs_errcode validate_partition(struct cpuset *cs, struct cpuset *tri
if (cpumask_empty(trialcs->effective_xcpus))
return PERR_INVCPUS;
+ if ((parent == &top_cpuset) && !is_partition_valid(cs) &&
+ cpumask_intersects(trialcs->exclusive_cpus, subpartitions_cpus))
+ return PERR_REMOTE;
+
if (prstate_housekeeping_conflict(trialcs->partition_root_state,
trialcs->effective_xcpus))
return PERR_HKEEPING;
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index b732078bf319..f62155cf6162 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -321,6 +321,8 @@ TEST_MATRIX=(
" C1-3:P2 X4:P2 . . . X3:P2 . . 0 A1:1-2|XA1:1-3|A2:3:XA2:3 A1:P2|A2:P2 1-3"
" C0-3:P2 . . C4-6 C0-4 . . . 0 A1:0-4|B1:5-6 A1:P2|B1:P0"
" C0-3:P2 . . C4-6 C0-4:C0-3 . . . 0 A1:0-3|B1:4-6 A1:P2|B1:P0 0-3"
+ " X1-3:P1 CX2-3:P2 . . C1-3 . . . 0 A1:1|A2:2-3|XA2:2-3 \
+ A1:P-1|A2:P2 2-3"
# Local partition invalidation tests
" C0-3:X1-3:P2 C1-3:X2-3:P2 C2-3:X3:P2 \
@@ -443,6 +445,7 @@ TEST_MATRIX=(
# Changes to cpuset.cpus.exclusive that violate exclusivity rule is rejected
" C0-3 . . C4-5 X0-3 . . X3-5 1 A1:0-3|B1:4-5"
+ " C0-3:P1 . . C4-5 . . . X3-5 1 A1:0-3|B1:4-5 A1:P1|B1:P0"
# cpuset.cpus.exclusive cannot be set to a superset of sibling's cpuset.cpus
" C0-3 . . C4-5 X3-5 . . . 1 A1:0-3|B1:4-5"
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/2] cgroup/cpuset: prevent local partition activation over remote partition and sibling xcpus conflict
2026-09-20 8:23 ` [PATCH v2 2/2] cgroup/cpuset: prevent local partition activation over remote partition and sibling xcpus conflict Hui Peng
@ 2026-09-20 8:57 ` Guopeng Zhang
2026-09-20 18:14 ` [PATCH v3 1/3] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() Hui Peng
2026-09-20 18:14 ` [PATCH v2 2/2] cgroup/cpuset: prevent local partition activation over remote partition and sibling xcpus conflict Hui Peng
0 siblings, 2 replies; 11+ messages in thread
From: Guopeng Zhang @ 2026-09-20 8:57 UTC (permalink / raw)
To: Hui Peng, Tejun Heo, Johannes Weiner, Waiman Long, Ridong Chen
Cc: Michal Koutny, Shuah Khan, cgroups, linux-kselftest, linux-kernel
在 2026/9/20 16:23, Hui Peng 写道:
> Commit 6da580ec656a ("cgroup/cpuset: Don't allow creation of local
> partition over a remote one") added a check in update_prstate() to reject
> creating a top-level local partition whose cs->exclusive_cpus intersects
> subpartitions_cpus.
>
> However, two paths still allow overlapping exclusive CPU ownership between
> a top-level local partition and a remote partition or sibling:
>
> 1. If a top-level cgroup A1 has cpuset.cpus.exclusive set, is first set to
> "root" while cpuset.cpus is empty (becoming "root invalid"), has a
> child A1/A2 enabled as a remote partition on those exclusive CPUs, and
> then receives CPUs via A1/cpuset.cpus, update_cpumasks_hier() calls
> validate_partition() without going through update_prstate(). Because
> validate_partition() does not check trialcs->exclusive_cpus against
> subpartitions_cpus, A1 transitions from "root invalid" to a valid local
> partition over the existing remote partition A1/A2 and triggers:
>
> WARNING: kernel/cgroup/cpuset.c:1866 at update_parent_effective_cpumask+0x54a/0x8a0
>
> 2. In cpus_excl_conflict(), when a valid local partition A1 uses implicit
> exclusive CPUs (cpuset.cpus set without cpuset.cpus.exclusive, so
> sibling->exclusive_cpus is empty while sibling->effective_xcpus is
> populated), a sibling cgroup B1 can still set cpuset.cpus.exclusive on
> the same CPUs because cpus_excl_conflict() only checks
> sibling->exclusive_cpus.
>
> Fix these issues by:
> - Checking trialcs->exclusive_cpus against subpartitions_cpus in
> validate_partition() when !is_partition_valid(cs).
> - Falling back to sibling->effective_xcpus in cpus_excl_conflict() when
> sibling->exclusive_cpus is empty.
> - Adding regression test cases for both paths to
> tools/testing/selftests/cgroup/test_cpuset_prs.sh.
>
> Tested in QEMU on Linux 7.3.0-rc3 using
> tools/testing/selftests/cgroup/test_cpuset_prs.sh.
>
> Fixes: 6da580ec656a ("cgroup/cpuset: Don't allow creation of local partition over a remote one")
I think this patch is still missing a Fixes: tag for the
cpus_excl_conflict() change.
The validate_partition() change can be covered by 6da580ec656a.
However, the sibling CPU ownership issue fixed in cpus_excl_conflict()
was introduced by the following commit:
Fixes: 2a3602030d80 ("cgroup/cpuset: Don't invalidate sibling partitions on cpuset.cpus conflict")
Thanks,
Guopeng
> Cc: stable@vger.kernel.org
> Signed-off-by: Hui Peng <benquike@gmail.com>
> ---
> Changes in v2:
> - Split from the remote_partition_enable() fix into patch 2/2.
> - Check trialcs->exclusive_cpus (rather than effective_xcpus) in
> validate_partition() when !is_partition_valid(cs) so sibling local
> partitions with overlapping cpuset.cpus continue to share remaining
> available CPUs as expected by test_cpuset_prs.sh.
> - Add regression tests to tools/testing/selftests/cgroup/test_cpuset_prs.sh.
>
> kernel/cgroup/cpuset.c | 9 ++++++++-
> tools/testing/selftests/cgroup/test_cpuset_prs.sh | 3 +++
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 7381fa8502e7..f46a51f07938 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -713,7 +713,10 @@ static inline bool cpus_excl_conflict(struct cpuset *trial, struct cpuset *sibli
> return true;
>
> /* Exclusive_cpus cannot intersect */
> - return cpumask_intersects(trial->exclusive_cpus, sibling->exclusive_cpus);
> + return cpumask_intersects(trial->exclusive_cpus,
> + cpumask_empty(sibling->exclusive_cpus)
> + ? sibling->effective_xcpus
> + : sibling->exclusive_cpus);
> }
>
> static inline bool mems_excl_conflict(struct cpuset *cs1, struct cpuset *cs2)
> @@ -2415,6 +2418,10 @@ static enum prs_errcode validate_partition(struct cpuset *cs, struct cpuset *tri
> if (cpumask_empty(trialcs->effective_xcpus))
> return PERR_INVCPUS;
>
> + if ((parent == &top_cpuset) && !is_partition_valid(cs) &&
> + cpumask_intersects(trialcs->exclusive_cpus, subpartitions_cpus))
> + return PERR_REMOTE;
> +
> if (prstate_housekeeping_conflict(trialcs->partition_root_state,
> trialcs->effective_xcpus))
> return PERR_HKEEPING;
> diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> index b732078bf319..f62155cf6162 100755
> --- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> +++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> @@ -321,6 +321,8 @@ TEST_MATRIX=(
> " C1-3:P2 X4:P2 . . . X3:P2 . . 0 A1:1-2|XA1:1-3|A2:3:XA2:3 A1:P2|A2:P2 1-3"
> " C0-3:P2 . . C4-6 C0-4 . . . 0 A1:0-4|B1:5-6 A1:P2|B1:P0"
> " C0-3:P2 . . C4-6 C0-4:C0-3 . . . 0 A1:0-3|B1:4-6 A1:P2|B1:P0 0-3"
> + " X1-3:P1 CX2-3:P2 . . C1-3 . . . 0 A1:1|A2:2-3|XA2:2-3 \
> + A1:P-1|A2:P2 2-3"
>
> # Local partition invalidation tests
> " C0-3:X1-3:P2 C1-3:X2-3:P2 C2-3:X3:P2 \
> @@ -443,6 +445,7 @@ TEST_MATRIX=(
>
> # Changes to cpuset.cpus.exclusive that violate exclusivity rule is rejected
> " C0-3 . . C4-5 X0-3 . . X3-5 1 A1:0-3|B1:4-5"
> + " C0-3:P1 . . C4-5 . . . X3-5 1 A1:0-3|B1:4-5 A1:P1|B1:P0"
>
> # cpuset.cpus.exclusive cannot be set to a superset of sibling's cpuset.cpus
> " C0-3 . . C4-5 X3-5 . . . 1 A1:0-3|B1:4-5"
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/2] cgroup/cpuset: prevent local partition activation over remote partition and sibling xcpus conflict
2026-09-20 8:57 ` Guopeng Zhang
2026-09-20 18:14 ` [PATCH v3 1/3] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() Hui Peng
@ 2026-09-20 18:14 ` Hui Peng
1 sibling, 0 replies; 11+ messages in thread
From: Hui Peng @ 2026-09-20 18:14 UTC (permalink / raw)
To: Guopeng Zhang, Tejun Heo, Johannes Weiner, Waiman Long,
Ridong Chen
Cc: Michal Koutny, Shuah Khan, cgroups, linux-kselftest, linux-kernel
On Sun, Sep 20, 2026 at 04:57:39PM +0800, Guopeng Zhang wrote:
> I think this patch is still missing a Fixes: tag for the
> cpus_excl_conflict() change.
>
> The validate_partition() change can be covered by 6da580ec656a.
>
> However, the sibling CPU ownership issue fixed in cpus_excl_conflict()
> was introduced by the following commit:
> Fixes: 2a3602030d80 ("cgroup/cpuset: Don't invalidate sibling partitions on cpuset.cpus conflict")
Thanks for pointing this out, Guopeng!
In v3, I have split the validate_partition() change (with
Fixes: 6da580ec656a) and the cpus_excl_conflict() change (with
Fixes: 2a3602030d80) into separate patches ([PATCH v3 2/3] and
[PATCH v3 3/3]) so that each patch fixes a single logical issue with its
corresponding Fixes: tag.
Best regards,
Hui
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 1/3] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable()
2026-09-20 8:57 ` Guopeng Zhang
@ 2026-09-20 18:14 ` Hui Peng
2026-09-20 18:14 ` [PATCH v3 2/3] cgroup/cpuset: prevent activating local partition over remote one Hui Peng
` (2 more replies)
2026-09-20 18:14 ` [PATCH v2 2/2] cgroup/cpuset: prevent local partition activation over remote partition and sibling xcpus conflict Hui Peng
1 sibling, 3 replies; 11+ messages in thread
From: Hui Peng @ 2026-09-20 18:14 UTC (permalink / raw)
To: Guopeng Zhang, Tejun Heo, Johannes Weiner, Waiman Long,
Ridong Chen
Cc: Michal Koutny, Shuah Khan, cgroups, linux-kselftest, linux-kernel,
stable, Hui Peng
Commit 6da580ec656a ("cgroup/cpuset: Don't allow creation of local
partition over a remote one") updated update_prstate() to prevent creating
a top-level local partition whose exclusive CPUs conflict with an existing
remote partition.
However, if a top-level local partition A1 is created on CPUs 1-3, has a
non-partition member child A1/A2 with cpuset.cpus.exclusive = 1-3, and a
grandchild A1/A2/A3 is then enabled as a partition root on 1-3,
update_prstate() sees !is_partition_valid(parent) (since A1/A2 is a member)
and calls remote_partition_enable(). Because remote_partition_enable() does
not check whether tmp->new_cpus intersects subpartitions_cpus, A1/A2/A3 is
enabled as a remote partition on CPUs already owned by A1, triggering:
WARNING: kernel/cgroup/cpuset.c:1594 at update_prstate+0xbef/0xd70
Return PERR_NOCPUS in remote_partition_enable() when tmp->new_cpus
intersects subpartitions_cpus, matching the error code used by
remote_cpus_update() for subpartitions_cpus conflicts, and add a
corresponding regression test case to
tools/testing/selftests/cgroup/test_cpuset_prs.sh.
Tested in QEMU on Linux 7.3.0-rc3 using
tools/testing/selftests/cgroup/test_cpuset_prs.sh.
Fixes: 6da580ec656a ("cgroup/cpuset: Don't allow creation of local partition over a remote one")
Suggested-by: Guopeng Zhang <guopeng.zhang@linux.dev>
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Hui Peng <benquike@gmail.com>
---
Changes in v3:
- Split the series into 3 patches (one per logical change and Fixes: tag).
kernel/cgroup/cpuset.c | 4 +++-
tools/testing/selftests/cgroup/test_cpuset_prs.sh | 2 ++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index c8ab89cfbe3d..7381fa8502e7 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1678,8 +1678,10 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
* Callers must have validated that effective_xcpus is not empty.
*/
spin_lock_irq(&callback_lock);
- if (cpumask_subset(top_cpuset.effective_cpus, tmp->new_cpus)) {
+ if (cpumask_intersects(tmp->new_cpus, subpartitions_cpus) ||
+ cpumask_subset(top_cpuset.effective_cpus, tmp->new_cpus)) {
spin_unlock_irq(&callback_lock);
+ if (cpumask_intersects(tmp->new_cpus, subpartitions_cpus))
+ return PERR_NOCPUS;
return PERR_HKEEPING;
}
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index a1f42ef64bc1..b732078bf319 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -298,6 +298,8 @@ TEST_MATRIX=(
" C0-4:X2-4 C1-4:X2-4:P2 C2-4:X4:P1 \
. . . X1 . 0 A1:0-1|A2:2-4|A3:2-4 \
A1:P0|A2:P2|A3:P-1 2-4"
+ " CX1-3:P1 CX1-3 CX1-3 . . . P1 . 0 A1:1-3|A2:1-3|A3:1-3 \
+ A1:P1|A2:P0|A3:P-1"
# Remote partition offline tests
" C0-3 C1-3 C2-3 . X2-3 X2-3 X2-3:P2:O2=0 . 0 A1:0-1|A2:1|A3:3 A1:P0|A3:P2 2-3"
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 2/3] cgroup/cpuset: prevent activating local partition over remote one
2026-09-20 18:14 ` [PATCH v3 1/3] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() Hui Peng
@ 2026-09-20 18:14 ` Hui Peng
2026-09-22 20:21 ` Waiman Long
2026-09-20 18:14 ` [PATCH v3 3/3] cgroup/cpuset: check sibling effective_xcpus in cpus_excl_conflict() Hui Peng
2026-09-21 7:08 ` [PATCH v3 1/3] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() Ridong Chen
2 siblings, 1 reply; 11+ messages in thread
From: Hui Peng @ 2026-09-20 18:14 UTC (permalink / raw)
To: Guopeng Zhang, Tejun Heo, Johannes Weiner, Waiman Long,
Ridong Chen
Cc: Michal Koutny, Shuah Khan, cgroups, linux-kselftest, linux-kernel,
stable, Hui Peng
Commit 6da580ec656a ("cgroup/cpuset: Don't allow creation of local
partition over a remote one") added a check in update_prstate() to reject
creating a top-level local partition whose cs->exclusive_cpus intersects
subpartitions_cpus.
However, if a top-level cgroup A1 is first set to "root" with all CPUs
(CX0-7:P1, becoming "root invalid" because no CPUs would remain in
top_cpuset), has a child A1/A2 enabled as a remote partition on a subset
of those exclusive CPUs (CX2-3:P2), and A1 is then updated to a valid CPU
subset (CX1-3), update_exclusive_cpumask() / update_cpumask() calls
validate_partition() without going through update_prstate(). Because
validate_partition() does not check trialcs->exclusive_cpus against
subpartitions_cpus, A1 transitions from "root invalid" to a valid local
partition over the existing remote partition A1/A2 and triggers:
WARNING: kernel/cgroup/cpuset.c:1943 at update_parent_effective_cpumask+0x189b/0x1fd0
Check trialcs->exclusive_cpus against subpartitions_cpus in
validate_partition() when !is_partition_valid(cs), and add a regression
test case to tools/testing/selftests/cgroup/test_cpuset_prs.sh.
Tested in QEMU on Linux 7.3.0-rc3 using
tools/testing/selftests/cgroup/test_cpuset_prs.sh.
Fixes: 6da580ec656a ("cgroup/cpuset: Don't allow creation of local partition over a remote one")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Hui Peng <benquike@gmail.com>
---
Changes in v3:
- Split the validate_partition() fix (Fixes: 6da580ec656a) and the
cpus_excl_conflict() fix (Fixes: 2a3602030d80) into separate patches.
kernel/cgroup/cpuset.c | 4 ++++
tools/testing/selftests/cgroup/test_cpuset_prs.sh | 2 ++
2 files changed, 6 insertions(+)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 7381fa8502e7..7c5b4a8f1f3a 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2415,6 +2415,10 @@ static enum prs_errcode validate_partition(struct cpuset *cs, struct cpuset *tri
if (cpumask_empty(trialcs->effective_xcpus))
return PERR_INVCPUS;
+ if ((parent == &top_cpuset) && !is_partition_valid(cs) &&
+ cpumask_intersects(trialcs->exclusive_cpus, subpartitions_cpus))
+ return PERR_REMOTE;
+
if (prstate_housekeeping_conflict(trialcs->partition_root_state,
trialcs->effective_xcpus))
return PERR_HKEEPING;
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index b732078bf319..f4d1822d4e21 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -321,6 +321,8 @@ TEST_MATRIX=(
" C1-3:P2 X4:P2 . . . X3:P2 . . 0 A1:1-2|XA1:1-3|A2:3:XA2:3 A1:P2|A2:P2 1-3"
" C0-3:P2 . . C4-6 C0-4 . . . 0 A1:0-4|B1:5-6 A1:P2|B1:P0"
" C0-3:P2 . . C4-6 C0-4:C0-3 . . . 0 A1:0-3|B1:4-6 A1:P2|B1:P0 0-3"
+ " CX0-7:P1 CX2-3:P2 . . CX1-3 . . . 0 A1:1|A2:2-3|XA2:2-3 \
+ A1:P-1|A2:P2 2-3"
# Local partition invalidation tests
" C0-3:X1-3:P2 C1-3:X2-3:P2 C2-3:X3:P2 \
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 3/3] cgroup/cpuset: check sibling effective_xcpus in cpus_excl_conflict()
2026-09-20 18:14 ` [PATCH v3 1/3] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() Hui Peng
2026-09-20 18:14 ` [PATCH v3 2/3] cgroup/cpuset: prevent activating local partition over remote one Hui Peng
@ 2026-09-20 18:14 ` Hui Peng
2026-09-21 7:08 ` [PATCH v3 1/3] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() Ridong Chen
2 siblings, 0 replies; 11+ messages in thread
From: Hui Peng @ 2026-09-20 18:14 UTC (permalink / raw)
To: Guopeng Zhang, Tejun Heo, Johannes Weiner, Waiman Long,
Ridong Chen
Cc: Michal Koutny, Shuah Khan, cgroups, linux-kselftest, linux-kernel,
stable, Hui Peng
In cpus_excl_conflict(), when a valid local partition A1 uses implicit
exclusive CPUs (cpuset.cpus set without cpuset.cpus.exclusive, so
sibling->exclusive_cpus is empty while sibling->effective_xcpus is
populated), a sibling cgroup B1 can still set cpuset.cpus.exclusive on
the same CPUs because cpus_excl_conflict() only checks
sibling->exclusive_cpus.
Fall back to sibling->effective_xcpus in cpus_excl_conflict() when
sibling->exclusive_cpus is empty, and add a regression test case to
tools/testing/selftests/cgroup/test_cpuset_prs.sh.
Tested in QEMU on Linux 7.3.0-rc3 using
tools/testing/selftests/cgroup/test_cpuset_prs.sh.
Fixes: 2a3602030d80 ("cgroup/cpuset: Don't invalidate sibling partitions on cpuset.cpus conflict")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Hui Peng <benquike@gmail.com>
---
Changes in v3:
- Split out from the validate_partition() fix into patch 3/3 and add the
Fixes tag for commit 2a3602030d80, as pointed out by Guopeng Zhang.
kernel/cgroup/cpuset.c | 5 ++++-
tools/testing/selftests/cgroup/test_cpuset_prs.sh | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 7c5b4a8f1f3a..f46a51f07938 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -713,7 +713,10 @@ static inline bool cpus_excl_conflict(struct cpuset *trial, struct cpuset *sibli
return true;
/* Exclusive_cpus cannot intersect */
- return cpumask_intersects(trial->exclusive_cpus, sibling->exclusive_cpus);
+ return cpumask_intersects(trial->exclusive_cpus,
+ cpumask_empty(sibling->exclusive_cpus)
+ ? sibling->effective_xcpus
+ : sibling->exclusive_cpus);
}
static inline bool mems_excl_conflict(struct cpuset *cs1, struct cpuset *cs2)
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index f4d1822d4e21..f62155cf6162 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -445,6 +445,7 @@ TEST_MATRIX=(
# Changes to cpuset.cpus.exclusive that violate exclusivity rule is rejected
" C0-3 . . C4-5 X0-3 . . X3-5 1 A1:0-3|B1:4-5"
+ " C0-3:P1 . . C4-5 . . . X3-5 1 A1:0-3|B1:4-5 A1:P1|B1:P0"
# cpuset.cpus.exclusive cannot be set to a superset of sibling's cpuset.cpus
" C0-3 . . C4-5 X3-5 . . . 1 A1:0-3|B1:4-5"
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/3] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable()
2026-09-20 18:14 ` [PATCH v3 1/3] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() Hui Peng
2026-09-20 18:14 ` [PATCH v3 2/3] cgroup/cpuset: prevent activating local partition over remote one Hui Peng
2026-09-20 18:14 ` [PATCH v3 3/3] cgroup/cpuset: check sibling effective_xcpus in cpus_excl_conflict() Hui Peng
@ 2026-09-21 7:08 ` Ridong Chen
2026-09-22 8:00 ` Hui Peng
2 siblings, 1 reply; 11+ messages in thread
From: Ridong Chen @ 2026-09-21 7:08 UTC (permalink / raw)
To: Hui Peng, Guopeng Zhang, Tejun Heo, Johannes Weiner, Waiman Long
Cc: Michal Koutny, Shuah Khan, cgroups, linux-kselftest, linux-kernel,
stable
On 9/21/2026 2:14 AM, Hui Peng wrote:
> Commit 6da580ec656a ("cgroup/cpuset: Don't allow creation of local
> partition over a remote one") updated update_prstate() to prevent creating
> a top-level local partition whose exclusive CPUs conflict with an existing
> remote partition.
>
> However, if a top-level local partition A1 is created on CPUs 1-3, has a
> non-partition member child A1/A2 with cpuset.cpus.exclusive = 1-3, and a
> grandchild A1/A2/A3 is then enabled as a partition root on 1-3,
> update_prstate() sees !is_partition_valid(parent) (since A1/A2 is a member)
> and calls remote_partition_enable(). Because remote_partition_enable() does
> not check whether tmp->new_cpus intersects subpartitions_cpus, A1/A2/A3 is
> enabled as a remote partition on CPUs already owned by A1, triggering:
>
> WARNING: kernel/cgroup/cpuset.c:1594 at update_prstate+0xbef/0xd70
>
> Return PERR_NOCPUS in remote_partition_enable() when tmp->new_cpus
> intersects subpartitions_cpus, matching the error code used by
> remote_cpus_update() for subpartitions_cpus conflicts, and add a
> corresponding regression test case to
> tools/testing/selftests/cgroup/test_cpuset_prs.sh.
>
> Tested in QEMU on Linux 7.3.0-rc3 using
> tools/testing/selftests/cgroup/test_cpuset_prs.sh.
>
> Fixes: 6da580ec656a ("cgroup/cpuset: Don't allow creation of local partition over a remote one")
> Suggested-by: Guopeng Zhang <guopeng.zhang@linux.dev>
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Hui Peng <benquike@gmail.com>
> ---
> Changes in v3:
> - Split the series into 3 patches (one per logical change and Fixes: tag).
>
What is going on here?
Please do not reply with a new series. And I think the changes should be listed
in the cover letter. Otherwise, it will get very confusing.
> kernel/cgroup/cpuset.c | 4 +++-
> tools/testing/selftests/cgroup/test_cpuset_prs.sh | 2 ++
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index c8ab89cfbe3d..7381fa8502e7 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -1678,8 +1678,10 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
> * Callers must have validated that effective_xcpus is not empty.
> */
> spin_lock_irq(&callback_lock);
> - if (cpumask_subset(top_cpuset.effective_cpus, tmp->new_cpus)) {
> + if (cpumask_intersects(tmp->new_cpus, subpartitions_cpus) ||
> + cpumask_subset(top_cpuset.effective_cpus, tmp->new_cpus)) {
> spin_unlock_irq(&callback_lock);
> + if (cpumask_intersects(tmp->new_cpus, subpartitions_cpus))
> + return PERR_NOCPUS;
> return PERR_HKEEPING;
> }
>
I cannot apply this patch. It seems quite different from v2.
> diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> index a1f42ef64bc1..b732078bf319 100755
> --- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> +++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> @@ -298,6 +298,8 @@ TEST_MATRIX=(
> " C0-4:X2-4 C1-4:X2-4:P2 C2-4:X4:P1 \
> . . . X1 . 0 A1:0-1|A2:2-4|A3:2-4 \
> A1:P0|A2:P2|A3:P-1 2-4"
> + " CX1-3:P1 CX1-3 CX1-3 . . . P1 . 0 A1:1-3|A2:1-3|A3:1-3 \
> + A1:P1|A2:P0|A3:P-1"
>
> # Remote partition offline tests
> " C0-3 C1-3 C2-3 . X2-3 X2-3 X2-3:P2:O2=0 . 0 A1:0-1|A2:1|A3:3 A1:P0|A3:P2 2-3"
--
Best regards
Ridong
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/3] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable()
2026-09-21 7:08 ` [PATCH v3 1/3] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() Ridong Chen
@ 2026-09-22 8:00 ` Hui Peng
2026-09-22 20:04 ` Waiman Long
0 siblings, 1 reply; 11+ messages in thread
From: Hui Peng @ 2026-09-22 8:00 UTC (permalink / raw)
To: Ridong Chen
Cc: Tejun Heo, Johannes Weiner, Michal Koutný, Waiman Long,
Guopeng Zhang, Shuah Khan, cgroups, linux-kernel, linux-kselftest,
stable, Hui Peng
On Mon, Sep 21, 2026 at 03:08:55PM +0800, Ridong Chen wrote:
> What is going on here?
>
> Please do not reply with a new series. And I think the changes should be listed
> in the cover letter. Otherwise, it will get very confusing.
>
> ...
>
> I cannot apply this patch. It seems quite different from v2.
Hi Ridong,
Sorry for the confusion and the noise. Two mistakes happened when I
prepared v3 after splitting patch 2/2 per Guopeng's feedback:
1. I mistakenly passed --in-reply-to pointing to the v2 thread and
omitted the 0/3 cover letter.
2. Patch 1/3 was accidentally overwritten with a broken diff instead of
the remote_partition_enable() hunk from v2 1/2:
@@ -1591,10 +1591,11 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
* above it or remote partition root underneath it is not allowed.
*/
compute_excpus(cs, tmp->new_cpus);
- WARN_ON_ONCE(cpumask_intersects(tmp->new_cpus, subpartitions_cpus));
if (!cpumask_intersects(tmp->new_cpus, cpu_active_mask) ||
cpumask_subset(top_cpuset.effective_cpus, tmp->new_cpus))
return PERR_INVCPUS;
+ if (cpumask_intersects(tmp->new_cpus, subpartitions_cpus))
+ return PERR_NOCPUS;
Would it be OK if I post a clean, standalone [PATCH v4 0/3..3/3] series
(as a new thread with a 0/3 cover letter listing the changelog and with
the v2 1/2 diff restored in patch 1/3)?
Best regards,
Hui
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/3] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable()
2026-09-22 8:00 ` Hui Peng
@ 2026-09-22 20:04 ` Waiman Long
0 siblings, 0 replies; 11+ messages in thread
From: Waiman Long @ 2026-09-22 20:04 UTC (permalink / raw)
To: Hui Peng, Ridong Chen
Cc: Tejun Heo, Johannes Weiner, Michal Koutný, Guopeng Zhang,
Shuah Khan, cgroups, linux-kernel, linux-kselftest, stable
On 9/22/26 4:00 AM, Hui Peng wrote:
> On Mon, Sep 21, 2026 at 03:08:55PM +0800, Ridong Chen wrote:
>> What is going on here?
>>
>> Please do not reply with a new series. And I think the changes should be listed
>> in the cover letter. Otherwise, it will get very confusing.
>>
>> ...
>>
>> I cannot apply this patch. It seems quite different from v2.
> Hi Ridong,
>
> Sorry for the confusion and the noise. Two mistakes happened when I
> prepared v3 after splitting patch 2/2 per Guopeng's feedback:
>
> 1. I mistakenly passed --in-reply-to pointing to the v2 thread and
> omitted the 0/3 cover letter.
> 2. Patch 1/3 was accidentally overwritten with a broken diff instead of
> the remote_partition_enable() hunk from v2 1/2:
>
> @@ -1591,10 +1591,11 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
> * above it or remote partition root underneath it is not allowed.
> */
> compute_excpus(cs, tmp->new_cpus);
> - WARN_ON_ONCE(cpumask_intersects(tmp->new_cpus, subpartitions_cpus));
> if (!cpumask_intersects(tmp->new_cpus, cpu_active_mask) ||
> cpumask_subset(top_cpuset.effective_cpus, tmp->new_cpus))
> return PERR_INVCPUS;
> + if (cpumask_intersects(tmp->new_cpus, subpartitions_cpus))
> + return PERR_NOCPUS;
>
> Would it be OK if I post a clean, standalone [PATCH v4 0/3..3/3] series
> (as a new thread with a 0/3 cover letter listing the changelog and with
> the v2 1/2 diff restored in patch 1/3)?
That diff looks more correct. Please send out a new standalone v4 patch
series with your patches.
Cheers,
Longman
> Best regards,
> Hui
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 2/3] cgroup/cpuset: prevent activating local partition over remote one
2026-09-20 18:14 ` [PATCH v3 2/3] cgroup/cpuset: prevent activating local partition over remote one Hui Peng
@ 2026-09-22 20:21 ` Waiman Long
0 siblings, 0 replies; 11+ messages in thread
From: Waiman Long @ 2026-09-22 20:21 UTC (permalink / raw)
To: Hui Peng, Guopeng Zhang, Tejun Heo, Johannes Weiner, Ridong Chen
Cc: Michal Koutny, Shuah Khan, cgroups, linux-kselftest, linux-kernel,
stable
On 9/20/26 2:14 PM, Hui Peng wrote:
> Commit 6da580ec656a ("cgroup/cpuset: Don't allow creation of local
> partition over a remote one") added a check in update_prstate() to reject
> creating a top-level local partition whose cs->exclusive_cpus intersects
> subpartitions_cpus.
>
> However, if a top-level cgroup A1 is first set to "root" with all CPUs
> (CX0-7:P1, becoming "root invalid" because no CPUs would remain in
> top_cpuset), has a child A1/A2 enabled as a remote partition on a subset
> of those exclusive CPUs (CX2-3:P2), and A1 is then updated to a valid CPU
> subset (CX1-3), update_exclusive_cpumask() / update_cpumask() calls
> validate_partition() without going through update_prstate(). Because
> validate_partition() does not check trialcs->exclusive_cpus against
> subpartitions_cpus, A1 transitions from "root invalid" to a valid local
> partition over the existing remote partition A1/A2 and triggers:
>
> WARNING: kernel/cgroup/cpuset.c:1943 at update_parent_effective_cpumask+0x189b/0x1fd0
>
> Check trialcs->exclusive_cpus against subpartitions_cpus in
> validate_partition() when !is_partition_valid(cs), and add a regression
> test case to tools/testing/selftests/cgroup/test_cpuset_prs.sh.
>
> Tested in QEMU on Linux 7.3.0-rc3 using
> tools/testing/selftests/cgroup/test_cpuset_prs.sh.
>
> Fixes: 6da580ec656a ("cgroup/cpuset: Don't allow creation of local partition over a remote one")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Hui Peng <benquike@gmail.com>
> ---
> Changes in v3:
> - Split the validate_partition() fix (Fixes: 6da580ec656a) and the
> cpus_excl_conflict() fix (Fixes: 2a3602030d80) into separate patches.
>
> kernel/cgroup/cpuset.c | 4 ++++
> tools/testing/selftests/cgroup/test_cpuset_prs.sh | 2 ++
> 2 files changed, 6 insertions(+)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 7381fa8502e7..7c5b4a8f1f3a 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -2415,6 +2415,10 @@ static enum prs_errcode validate_partition(struct cpuset *cs, struct cpuset *tri
> if (cpumask_empty(trialcs->effective_xcpus))
> return PERR_INVCPUS;
>
> + if ((parent == &top_cpuset) && !is_partition_valid(cs) &&
> + cpumask_intersects(trialcs->exclusive_cpus, subpartitions_cpus))
> + return PERR_REMOTE;
> +
This additional check looks good.
> if (prstate_housekeeping_conflict(trialcs->partition_root_state,
> trialcs->effective_xcpus))
> return PERR_HKEEPING;
> diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> index b732078bf319..f4d1822d4e21 100755
> --- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> +++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> @@ -321,6 +321,8 @@ TEST_MATRIX=(
> " C1-3:P2 X4:P2 . . . X3:P2 . . 0 A1:1-2|XA1:1-3|A2:3:XA2:3 A1:P2|A2:P2 1-3"
> " C0-3:P2 . . C4-6 C0-4 . . . 0 A1:0-4|B1:5-6 A1:P2|B1:P0"
> " C0-3:P2 . . C4-6 C0-4:C0-3 . . . 0 A1:0-3|B1:4-6 A1:P2|B1:P0 0-3"
> + " CX0-7:P1 CX2-3:P2 . . CX1-3 . . . 0 A1:1|A2:2-3|XA2:2-3 \
> + A1:P-1|A2:P2 2-3"
This test will not work because you are assuming the test system only
have 8 CPUs. That may not be the case and 2 local partitions may be
created instead.
Cheers,
Longman
>
> # Local partition invalidation tests
> " C0-3:X1-3:P2 C1-3:X2-3:P2 C2-3:X3:P2 \
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-09-22 20:21 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <139d9231-4723-4365-9af7-8142e6581ede@linux.dev>
2026-09-20 8:23 ` [PATCH v2 1/2] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() on subpartitions_cpus conflict Hui Peng
2026-09-20 8:23 ` [PATCH v2 2/2] cgroup/cpuset: prevent local partition activation over remote partition and sibling xcpus conflict Hui Peng
2026-09-20 8:57 ` Guopeng Zhang
2026-09-20 18:14 ` [PATCH v3 1/3] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() Hui Peng
2026-09-20 18:14 ` [PATCH v3 2/3] cgroup/cpuset: prevent activating local partition over remote one Hui Peng
2026-09-22 20:21 ` Waiman Long
2026-09-20 18:14 ` [PATCH v3 3/3] cgroup/cpuset: check sibling effective_xcpus in cpus_excl_conflict() Hui Peng
2026-09-21 7:08 ` [PATCH v3 1/3] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() Ridong Chen
2026-09-22 8:00 ` Hui Peng
2026-09-22 20:04 ` Waiman Long
2026-09-20 18:14 ` [PATCH v2 2/2] cgroup/cpuset: prevent local partition activation over remote partition and sibling xcpus conflict Hui Peng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox