]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cgroup/cpuset: Fix incorrect use of cpuset_update_tasks_cpumask() in update_cpumasks_...
authorWaiman Long <longman@redhat.com>
Sat, 21 Feb 2026 18:54:12 +0000 (13:54 -0500)
committerTejun Heo <tj@kernel.org>
Mon, 23 Feb 2026 20:41:01 +0000 (10:41 -1000)
Commit e2ffe502ba45 ("cgroup/cpuset: Add cpuset.cpus.exclusive for v2")
incorrectly changed the 2nd parameter of cpuset_update_tasks_cpumask()
from tmp->new_cpus to cp->effective_cpus. This second parameter is just
a temporary cpumask for internal use. The cpuset_update_tasks_cpumask()
function was originally called update_tasks_cpumask() before commit
381b53c3b549 ("cgroup/cpuset: rename functions shared between v1
and v2").

This mistake can incorrectly change the effective_cpus of the
cpuset when it is the top_cpuset or in arm64 architecture where
task_cpu_possible_mask() may differ from cpu_possible_mask.  So far
top_cpuset hasn't been passed to update_cpumasks_hier() yet, but arm64
arch can still be impacted. Fix it by reverting the incorrect change.

Fixes: e2ffe502ba45 ("cgroup/cpuset: Add cpuset.cpus.exclusive for v2")
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup/cpuset.c

index a366ef84f98297cd8b0bfeb676e8cceb5b5189da..8dfffe2dc9ed65eca0f758218d9b8bb12d2a777a 100644 (file)
@@ -2157,7 +2157,7 @@ get_css:
                WARN_ON(!is_in_v2_mode() &&
                        !cpumask_equal(cp->cpus_allowed, cp->effective_cpus));
 
-               cpuset_update_tasks_cpumask(cp, cp->effective_cpus);
+               cpuset_update_tasks_cpumask(cp, tmp->new_cpus);
 
                /*
                 * On default hierarchy, inherit the CS_SCHED_LOAD_BALANCE