linux/tools/testing/selftests/cgroup
Waiman Long 272bd81833 cgroup/cpuset: Move the v1 empty cpus/mems check to cpuset1_validate_change()
As stated in commit 1c09b195d3 ("cpuset: fix a regression in validating
config change"), it is not allowed to clear masks of a cpuset if
there're tasks in it. This is specific to v1 since empty "cpuset.cpus"
or "cpuset.mems" will cause the v2 cpuset to inherit the effective CPUs
or memory nodes from its parent. So it is OK to have empty cpus or mems
even if there are tasks in the cpuset.

Move this empty cpus/mems check in validate_change() to
cpuset1_validate_change() to allow more flexibility in setting
cpus or mems in v2. cpuset_is_populated() needs to be moved into
cpuset-internal.h as it is needed by the empty cpus/mems checking code.

Also add a test case to test_cpuset_prs.sh to verify that.

Reported-by: Chen Ridong <chenridong@huaweicloud.com>
Closes: https://lore.kernel.org/lkml/7a3ec392-2e86-4693-aa9f-1e668a668b9c@huaweicloud.com/
Signed-off-by: Waiman Long <longman@redhat.com>
Reviewed-by: Chen Ridong <chenridong@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2026-01-12 09:03:22 -10:00
..
lib selftests: cgroup: Add cg_read_key_long_poll() to poll a cgroup key with retries 2025-12-08 08:44:54 -10:00
.gitignore selftests: cgroup: Add basic tests for pids controller 2024-05-26 08:45:10 -10:00
Makefile cgroup: selftests: Move cgroup_util into its own library 2025-05-16 11:45:15 -07:00
config mm: remove CONFIG_MEMCG_KMEM 2024-07-10 12:14:54 -07:00
memcg_protection.m selftests: memcg: adjust expected reclaim values of protected cgroups 2022-05-27 09:33:45 -07:00
test_core.c Significant patch series in this pull request: 2025-12-06 14:01:20 -08:00
test_cpu.c Significant patch series in this pull request: 2025-12-06 14:01:20 -08:00
test_cpuset.c Significant patch series in this pull request: 2025-12-06 14:01:20 -08:00
test_cpuset_prs.sh cgroup/cpuset: Move the v1 empty cpus/mems check to cpuset1_validate_change() 2026-01-12 09:03:22 -10:00
test_cpuset_v1_base.sh cgroup/cpuset: add sefltest for cpuset v1 2024-08-30 10:00:17 -10:00
test_cpuset_v1_hp.sh selftests/cgroup: use bash in test_cpuset_v1_hp.sh 2025-02-04 09:36:54 -10:00
test_freezer.c Significant patch series in this pull request: 2025-12-06 14:01:20 -08:00
test_hugetlb_memcg.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
test_kill.c Significant patch series in this pull request: 2025-12-06 14:01:20 -08:00
test_kmem.c selftests: cgroup: Replace sleep with cg_read_key_long_poll() for waiting on nr_dying_descendants 2025-12-08 08:44:54 -10:00
test_memcontrol.c selftests: cgroup: make test_memcg_sock robust against delayed sock stats 2025-12-08 08:44:54 -10:00
test_pids.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
test_stress.sh kseltest/cgroup: Make test_stress.sh work if run interactively 2022-05-13 09:33:21 -10:00
test_zswap.c Significant patch series in this pull request: 2025-12-06 14:01:20 -08:00
wait_inotify.c kselftest/cgroup: Add cpuset v2 partition root state test 2022-09-04 10:47:28 -10:00
with_stress.sh selftests: cgroup: Run test_core under interfering stress 2019-10-07 07:11:54 -07:00