Skip to content

Commit 15d428e

Browse files
Waiman-Longhtejun
authored andcommitted
cgroup/cpuset: Fix a partition bug with hotplug
In cpuset_hotplug_workfn(), the detection of whether the cpu list has been changed is done by comparing the effective cpus of the top cpuset with the cpu_active_mask. However, in the rare case that just all the CPUs in the subparts_cpus are offlined, the detection fails and the partition states are not updated correctly. Fix it by forcing the cpus_updated flag to true in this particular case. Fixes: 4b842da ("cpuset: Make CPU hotplug work with partition") Signed-off-by: Waiman Long <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 0f3adb8 commit 15d428e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

kernel/cgroup/cpuset.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3166,6 +3166,13 @@ static void cpuset_hotplug_workfn(struct work_struct *work)
31663166
cpus_updated = !cpumask_equal(top_cpuset.effective_cpus, &new_cpus);
31673167
mems_updated = !nodes_equal(top_cpuset.effective_mems, new_mems);
31683168

3169+
/*
3170+
* In the rare case that hotplug removes all the cpus in subparts_cpus,
3171+
* we assumed that cpus are updated.
3172+
*/
3173+
if (!cpus_updated && top_cpuset.nr_subparts_cpus)
3174+
cpus_updated = true;
3175+
31693176
/* synchronize cpus_allowed to cpu_active_mask */
31703177
if (cpus_updated) {
31713178
spin_lock_irq(&callback_lock);

0 commit comments

Comments
 (0)