Message ID | 20210720141834.10624-3-longman@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | cgroup/cpuset: Add new cpuset partition type & empty effecitve cpus | expand |
On Tue, Jul 20, 2021 at 10:18:27AM -0400, Waiman Long wrote: > 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: 4b842da276a8 ("cpuset: Make CPU hotplug work with partition") > Signed-off-by: Waiman Long <longman@redhat.com> Applied to cgroup/for-5.15 w/ a minor update to the comment (I dropped "just" before "all". It read weird to me.) Thanks.
On 7/26/21 6:59 PM, Tejun Heo wrote: > On Tue, Jul 20, 2021 at 10:18:27AM -0400, Waiman Long wrote: >> 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: 4b842da276a8 ("cpuset: Make CPU hotplug work with partition") >> Signed-off-by: Waiman Long <longman@redhat.com> > Applied to cgroup/for-5.15 w/ a minor update to the comment (I dropped > "just" before "all". It read weird to me.) > > Thanks. > Thanks for fixing the wording. Cheers, Longman
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index f5fef5516d99..b00982e6f6d8 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -3166,6 +3166,13 @@ static void cpuset_hotplug_workfn(struct work_struct *work) cpus_updated = !cpumask_equal(top_cpuset.effective_cpus, &new_cpus); mems_updated = !nodes_equal(top_cpuset.effective_mems, new_mems); + /* + * In the rare case that hotplug removes just all the cpus in + * subparts_cpus, we assumed that cpus are updated. + */ + if (!cpus_updated && top_cpuset.nr_subparts_cpus) + cpus_updated = true; + /* synchronize cpus_allowed to cpu_active_mask */ if (cpus_updated) { spin_lock_irq(&callback_lock);
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: 4b842da276a8 ("cpuset: Make CPU hotplug work with partition") Signed-off-by: Waiman Long <longman@redhat.com> --- kernel/cgroup/cpuset.c | 7 +++++++ 1 file changed, 7 insertions(+)