]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cgroup/cpuset: Fix incorrect change to effective_xcpus in partition_xcpus_del()
authorWaiman Long <longman@redhat.com>
Sat, 21 Feb 2026 18:54:11 +0000 (13:54 -0500)
committerTejun Heo <tj@kernel.org>
Mon, 23 Feb 2026 20:40:58 +0000 (10:40 -1000)
The effective_xcpus of a cpuset can contain offline CPUs. In
partition_xcpus_del(), the xcpus parameter is incorrectly used as
a temporary cpumask to mask out offline CPUs. As xcpus can be the
effective_xcpus of a cpuset, this can result in unexpected changes
in that cpumask. Fix this problem by not making any changes to the
xcpus parameter.

Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated partitions")
Reviewed-by: Chen Ridong <chenridong@huaweicloud.com>
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup/cpuset.c

index c43efef7df71e96845266465f4b7ca0a51d41b49..a366ef84f98297cd8b0bfeb676e8cceb5b5189da 100644 (file)
@@ -1221,8 +1221,8 @@ static void partition_xcpus_del(int old_prs, struct cpuset *parent,
                isolated_cpus_update(old_prs, parent->partition_root_state,
                                     xcpus);
 
-       cpumask_and(xcpus, xcpus, cpu_active_mask);
        cpumask_or(parent->effective_cpus, parent->effective_cpus, xcpus);
+       cpumask_and(parent->effective_cpus, parent->effective_cpus, cpu_active_mask);
 }
 
 /*