[PATCH cgroup/for-7.4-fixes 0/2] cgroup/cpuset: Don't migrate the parent's memory on CLONE_INTO_CGROUP
From: Hang Zhengyang
Date: Fri Dec 04 2026 - 08:51:36 EST
Since v7.3, a child created with CLONE_INTO_CGROUP in a cpuset with
other mems has its mm migrated at fork. This moves the parent's memory:
the pages the two share, and with CLONE_VM, as posix_spawn() uses, also
the policies of the parent's mappings. Patch 1 stops the migration at
fork and leaves a shared mm alone. Patch 2 adds tests.
Caron Wills's "cgroup/cpuset: Don't make a forking task wait for memory
migration" [1], posted by Matthew Ruffell, removes the wait for this
migration, and Tejun asked for it to be split. With patch 1 there is
nothing to wait for at fork, so only its change for cpuset_attach() is
still needed. That part applies on top of patch 1; the cpuset_fork()
part conflicts.
Tested on cgroup/for-7.4-fixes in a KVM guest with two NUMA nodes: the
new tests fail without patch 1, also with only [1] applied, and pass
with patch 1. test_core, test_cpuset_prs.sh and the other test_cpuset
tests pass.
I used Claude Code to find the issue, write the patches and run the
tests. I reviewed the patches.
[1] https://lore.kernel.org/all/20261103075940.110308-7-matthew.ruffell@xxxxxxxxxxxxx/
Hang Zhengyang (2):
cgroup/cpuset: Don't migrate the parent's memory on CLONE_INTO_CGROUP
selftests/cgroup: Test CLONE_INTO_CGROUP into a cpuset with other mems
kernel/cgroup/cpuset.c | 23 ++-
tools/testing/selftests/cgroup/test_cpuset.c | 201 +++++++++++++++++++
2 files changed, 220 insertions(+), 4 deletions(-)
base-commit: f7d2a428108d90a4e3fdd2c4d7e4660e780855ff
--
2.53.0