|
@@ -3708,7 +3708,8 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu,
|
|
|
|
|
|
lockdep_assert_held(&wq_pool_mutex);
|
|
lockdep_assert_held(&wq_pool_mutex);
|
|
|
|
|
|
- if (!wq_numa_enabled || !(wq->flags & WQ_UNBOUND))
|
|
|
|
|
|
+ if (!wq_numa_enabled || !(wq->flags & WQ_UNBOUND) ||
|
|
|
|
+ wq->unbound_attrs->no_numa)
|
|
return;
|
|
return;
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -3719,10 +3720,6 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu,
|
|
target_attrs = wq_update_unbound_numa_attrs_buf;
|
|
target_attrs = wq_update_unbound_numa_attrs_buf;
|
|
cpumask = target_attrs->cpumask;
|
|
cpumask = target_attrs->cpumask;
|
|
|
|
|
|
- mutex_lock(&wq->mutex);
|
|
|
|
- if (wq->unbound_attrs->no_numa)
|
|
|
|
- goto out_unlock;
|
|
|
|
-
|
|
|
|
copy_workqueue_attrs(target_attrs, wq->unbound_attrs);
|
|
copy_workqueue_attrs(target_attrs, wq->unbound_attrs);
|
|
pwq = unbound_pwq_by_node(wq, node);
|
|
pwq = unbound_pwq_by_node(wq, node);
|
|
|
|
|
|
@@ -3734,33 +3731,26 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu,
|
|
*/
|
|
*/
|
|
if (wq_calc_node_cpumask(wq->dfl_pwq->pool->attrs, node, cpu_off, cpumask)) {
|
|
if (wq_calc_node_cpumask(wq->dfl_pwq->pool->attrs, node, cpu_off, cpumask)) {
|
|
if (cpumask_equal(cpumask, pwq->pool->attrs->cpumask))
|
|
if (cpumask_equal(cpumask, pwq->pool->attrs->cpumask))
|
|
- goto out_unlock;
|
|
|
|
|
|
+ return;
|
|
} else {
|
|
} else {
|
|
goto use_dfl_pwq;
|
|
goto use_dfl_pwq;
|
|
}
|
|
}
|
|
|
|
|
|
- mutex_unlock(&wq->mutex);
|
|
|
|
-
|
|
|
|
/* create a new pwq */
|
|
/* create a new pwq */
|
|
pwq = alloc_unbound_pwq(wq, target_attrs);
|
|
pwq = alloc_unbound_pwq(wq, target_attrs);
|
|
if (!pwq) {
|
|
if (!pwq) {
|
|
pr_warn("workqueue: allocation failed while updating NUMA affinity of \"%s\"\n",
|
|
pr_warn("workqueue: allocation failed while updating NUMA affinity of \"%s\"\n",
|
|
wq->name);
|
|
wq->name);
|
|
- mutex_lock(&wq->mutex);
|
|
|
|
goto use_dfl_pwq;
|
|
goto use_dfl_pwq;
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
- * Install the new pwq. As this function is called only from CPU
|
|
|
|
- * hotplug callbacks and applying a new attrs is wrapped with
|
|
|
|
- * get/put_online_cpus(), @wq->unbound_attrs couldn't have changed
|
|
|
|
- * inbetween.
|
|
|
|
- */
|
|
|
|
|
|
+ /* Install the new pwq. */
|
|
mutex_lock(&wq->mutex);
|
|
mutex_lock(&wq->mutex);
|
|
old_pwq = numa_pwq_tbl_install(wq, node, pwq);
|
|
old_pwq = numa_pwq_tbl_install(wq, node, pwq);
|
|
goto out_unlock;
|
|
goto out_unlock;
|
|
|
|
|
|
use_dfl_pwq:
|
|
use_dfl_pwq:
|
|
|
|
+ mutex_lock(&wq->mutex);
|
|
spin_lock_irq(&wq->dfl_pwq->pool->lock);
|
|
spin_lock_irq(&wq->dfl_pwq->pool->lock);
|
|
get_pwq(wq->dfl_pwq);
|
|
get_pwq(wq->dfl_pwq);
|
|
spin_unlock_irq(&wq->dfl_pwq->pool->lock);
|
|
spin_unlock_irq(&wq->dfl_pwq->pool->lock);
|