From: Guopeng Zhang <guopeng.zhang@linux.dev>
To: cgroups@vger.kernel.org, longman@redhat.com, ridong.chen@linux.dev
Cc: tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com,
shuah@kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org,
Guopeng Zhang <guopeng.zhang@linux.dev>
Subject: [PATCH v3 0/7] cgroup/cpuset: Fix partition type transitions
Date: Wed, 2 Sep 2026 18:26:08 +0800 [thread overview]
Message-ID: <20260902102615.79189-1-guopeng.zhang@linux.dev> (raw)
Several partition type-change and validation paths use effective_xcpus,
which also includes CPUs assigned to valid child partitions. As a result,
changing a parent between root and isolated can alter a child's isolation
accounting or fail housekeeping validation because of CPUs the parent does
not own.
A proposed parent CPU mask needs different treatment for children which
would become invalid under that mask. Their CPUs return to the parent and
must participate in housekeeping validation. Otherwise a parent can pass
validation with a boot-isolated CPU hidden behind a child which is about
to become invalid.
There are two related failure paths. Returning the last housekeeping CPU
from a root child to an isolated parent must invalidate the appropriate
isolated ancestor. Also, a root/isolated type change which fails
housekeeping validation must release the partition's CPUs instead of
leaving them unavailable to the owner of the invalidated subtree.
Factor out the child partition validity checks and reuse them when
computing the CPUs owned directly by a partition under a proposed
configuration. Use the directly owned CPUs for root/isolated type-change
accounting and housekeeping validation, handle the last-housekeeping-CPU
return case, and run the normal partition-disable path after a failed
type-change validation. Add focused selftests for each case.
This is based on cgroup/for-7.3-fixes (3f4b7d1a49c5 "selftests/cgroup:
test clone3() into a previously killed cgroup").
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.
Changes in v3:
- factor the child partition validity rules into a preparatory patch and
reuse them for trial ownership calculation;
- during trial validation, subtract only children which remain valid under
the proposed parent CPU mask, covering both PERR_INVCPUS and PERR_NOCPUS;
- keep cs->effective_xcpus as the default isolation-accounting mask and
use the directly owned mask only for a successful root/isolated type
change;
- use an isolated child for the boot-isolated trial-validation tests, as a
root child containing that CPU fails immediately with PERR_HKEEPING;
- make the isolated-ancestor walk safe when it reaches the top cpuset and
clarify the member-transition handling;
- clean up nested housekeeping-return test cgroups on failure.
Link: https://lore.kernel.org/all/20260828095643.13395-1-guopeng.zhang@linux.dev/
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@linux.dev/
Guopeng Zhang (7):
cgroup/cpuset: Factor out child partition validation
cgroup/cpuset: Account for child CPU ownership in partition changes
selftests/cgroup: Add tests for type-change isolation accounting
selftests/cgroup: Test child CPU ownership in partition changes
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 | 182 +++++++-
.../selftests/cgroup/test_cpuset_prs.sh | 430 +++++++++++++++++-
2 files changed, 588 insertions(+), 24 deletions(-)
base-commit: 3f4b7d1a49c5c826f3be9b684313eea5b83ac232
--
2.43.0
next reply other threads:[~2026-09-02 10:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 10:26 Guopeng Zhang [this message]
2026-09-02 10:26 ` [PATCH v3 1/7] cgroup/cpuset: Factor out child partition validation Guopeng Zhang
2026-09-03 18:33 ` Waiman Long
2026-09-04 1:25 ` Ridong Chen
2026-09-04 1:55 ` Ridong Chen
2026-09-04 1:57 ` Ridong Chen
2026-09-04 2:00 ` Ridong Chen
2026-09-03 19:11 ` Waiman Long
2026-09-02 10:26 ` [PATCH v3 2/7] cgroup/cpuset: Account for child CPU ownership in partition changes Guopeng Zhang
2026-09-02 10:26 ` [PATCH v3 3/7] selftests/cgroup: Add tests for type-change isolation accounting Guopeng Zhang
2026-09-02 10:26 ` [PATCH v3 4/7] selftests/cgroup: Test child CPU ownership in partition changes Guopeng Zhang
2026-09-02 10:26 ` [PATCH v3 5/7] selftests/cgroup: Add tests for housekeeping CPU return to isolated parents Guopeng Zhang
2026-09-02 10:26 ` [PATCH v3 6/7] cgroup/cpuset: Release CPUs when type-change validation fails Guopeng Zhang
2026-09-02 10:26 ` [PATCH v3 7/7] selftests/cgroup: Add CPU release tests for type-change validation failures Guopeng Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260902102615.79189-1-guopeng.zhang@linux.dev \
--to=guopeng.zhang@linux.dev \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mkoutny@suse.com \
--cc=ridong.chen@linux.dev \
--cc=shuah@kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox