Skip to content

Commit fbb3d4c

Browse files
Lai Jiangshanhtejun
authored andcommitted
workqueue: Simplify wq_calc_pod_cpumask() with wq_online_cpumask
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. Signed-off-by: Lai Jiangshan <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 8d84baf commit fbb3d4c

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

kernel/workqueue.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5146,20 +5146,14 @@ static void wq_calc_pod_cpumask(struct workqueue_attrs *attrs, int cpu,
51465146
const struct wq_pod_type *pt = wqattrs_pod_type(attrs);
51475147
int pod = pt->cpu_pod[cpu];
51485148

5149-
/* does @pod have any online CPUs @attrs wants? */
5149+
/* calculate possible CPUs in @pod that @attrs wants */
51505150
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)) {
51565153
cpumask_copy(attrs->__pod_cpumask, attrs->cpumask);
51575154
return;
51585155
}
51595156

5160-
/* yeap, return possible CPUs in @pod that @attrs wants */
5161-
cpumask_and(attrs->__pod_cpumask, attrs->cpumask, pt->pod_cpus[pod]);
5162-
51635157
if (cpumask_empty(attrs->__pod_cpumask))
51645158
pr_warn_once("WARNING: workqueue cpumask: online intersect > "
51655159
"possible intersect\n");

0 commit comments

Comments
 (0)