summaryrefslogtreecommitdiff
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorLai Jiangshan <jiangshan.ljs@antgroup.com>2024-07-11 16:35:42 +0800
committerTejun Heo <tj@kernel.org>2024-07-11 12:50:34 -1000
commitfbb3d4c15dc0fe8a439de267db927a9ab2f44e98 (patch)
tree9ef57269918b71a00d02c73e4b87442ee919e685 /kernel/workqueue.c
parent8d84baf76045f5b9567581cde17e9c3d256bb073 (diff)
downloadlwn-fbb3d4c15dc0fe8a439de267db927a9ab2f44e98.tar.gz
lwn-fbb3d4c15dc0fe8a439de267db927a9ab2f44e98.zip
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 <jiangshan.ljs@antgroup.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index e49afcb3d90a..a345a72395e7 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5146,20 +5146,14 @@ static void wq_calc_pod_cpumask(struct workqueue_attrs *attrs, int cpu,
const struct wq_pod_type *pt = wqattrs_pod_type(attrs);
int pod = pt->cpu_pod[cpu];
- /* does @pod have any online CPUs @attrs wants? */
+ /* calculate possible CPUs in @pod that @attrs wants */
cpumask_and(attrs->__pod_cpumask, pt->pod_cpus[pod], attrs->cpumask);
- cpumask_and(attrs->__pod_cpumask, attrs->__pod_cpumask, cpu_online_mask);
- if (cpu_going_down >= 0)
- cpumask_clear_cpu(cpu_going_down, attrs->__pod_cpumask);
-
- if (cpumask_empty(attrs->__pod_cpumask)) {
+ /* does @pod have any online CPUs @attrs wants? */
+ if (!cpumask_intersects(attrs->__pod_cpumask, wq_online_cpumask)) {
cpumask_copy(attrs->__pod_cpumask, attrs->cpumask);
return;
}
- /* yeap, return possible CPUs in @pod that @attrs wants */
- cpumask_and(attrs->__pod_cpumask, attrs->cpumask, pt->pod_cpus[pod]);
-
if (cpumask_empty(attrs->__pod_cpumask))
pr_warn_once("WARNING: workqueue cpumask: online intersect > "
"possible intersect\n");