Avoid relying on cpu_online_mask for wqattrs changes so that cpus_read_lock() can be removed from apply_wqattrs_lock(). And with wq_online_cpumask, attrs->__pod_cpumask doesn't need to be reused as a temporary storage to calculate if the pod have any online CPUs @attrs wants since @cpu_going_down is not in the wq_online_cpumask.
Showing the changes to kernel/workqueue.c (1 of 1 file). Show all
Unified · Split
| @@ -5146,20 +5146,14 @@ static void wq_calc_pod_cpumask(struct workqueue_attrs *attrs, int cpu, · 5145 unmodified lines | ||
| 5146 | 5146 | const struct wq_pod_type *pt = wqattrs_pod_type(attrs); |
| 5147 | 5147 | int pod = pt->cpu_pod[cpu]; |
| 5148 | 5148 | |
| 5149 | − /* does @pod have any online CPUs @attrs wants? */ | |
| 5149 | + /* calculate possible CPUs in @pod that @attrs wants */ | |
| 5150 | 5150 | cpumask_and(attrs->__pod_cpumask, pt->pod_cpus[pod], attrs->cpumask); |
| 5151 | − cpumask_and(attrs->__pod_cpumask, attrs->__pod_cpumask, cpu_online_mask); | |
| 5152 | − if (cpu_going_down >= 0) | |
| 5153 | − cpumask_clear_cpu(cpu_going_down, attrs->__pod_cpumask); | |
| 5154 | − | |
| 5155 | − if (cpumask_empty(attrs->__pod_cpumask)) { | |
| 5151 | + /* does @pod have any online CPUs @attrs wants? */ | |
| 5152 | + if (!cpumask_intersects(attrs->__pod_cpumask, wq_online_cpumask)) { | |
| 5156 | 5153 | cpumask_copy(attrs->__pod_cpumask, attrs->cpumask); |
| 5157 | 5154 | return; |
| 5158 | 5155 | } |
| 5159 | 5156 | |
| 5160 | − /* yeap, return possible CPUs in @pod that @attrs wants */ | |
| 5161 | − cpumask_and(attrs->__pod_cpumask, attrs->cpumask, pt->pod_cpus[pod]); | |
| 5162 | − | |
| 5163 | 5157 | if (cpumask_empty(attrs->__pod_cpumask)) |
| 5164 | 5158 | pr_warn_once("WARNING: workqueue cpumask: online intersect > " |
| 5165 | 5159 | "possible intersect\n"); |