mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-28 04:03:23 -04:00
As reported by sashiko [1], cpuset_hotplug_update_tasks() may perform unnecessary task iteration and updating of tasks' CPU and node masks when mems_allowed and/or cpus_allowed are not set in cpuset v2. It is due to the fact that the temporary new_cpus and new_mems masks do not inherit parent's effective_cpus/mems when they are empty which is the expected behavior for cpuset v2 since commit4ec22e9c5a("cpuset: Enable cpuset controller in default hierarchy"). Fix that and avoid unnecessary work by enhancing compute_effective_cpumask() to add the empty cpumask check and inheriting the parent's versions if empty when in v2. A new compute_effective_nodemask() helper is also added to perform a similar function for new effective_mems. Add new test_cpuset_prs.sh test cases to confirm that effective_cpus will inherit the parent's version if cpuset.cpus is empty. [1] https://sashiko.dev/#/patchset/20260621032816.1806773-1-longman%40redhat.com Suggested-by: Ridong Chen <ridong.chen@linux.dev> Fixes:4ec22e9c5a("cpuset: Enable cpuset controller in default hierarchy") Signed-off-by: Waiman Long <longman@redhat.com> Reviewed-by: Ridong Chen <ridong.chen@linux.dev> Signed-off-by: Tejun Heo <tj@kernel.org>