linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] cgroup/cpuset: Fix partition type transitions
@ 2026-09-02 10:26 Guopeng Zhang
  2026-09-02 10:26 ` [PATCH v3 1/7] cgroup/cpuset: Factor out child partition validation Guopeng Zhang
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Guopeng Zhang @ 2026-09-02 10:26 UTC (permalink / raw)
  To: cgroups, longman, ridong.chen
  Cc: tj, hannes, mkoutny, shuah, linux-kernel, linux-kselftest,
	Guopeng Zhang

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-09-04  2:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-02 10:26 [PATCH v3 0/7] cgroup/cpuset: Fix partition type transitions Guopeng Zhang
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).