Skip to content

Commit 8ac4dbe

Browse files
Lai Jiangshanhtejun
authored andcommitted
workqueue: Let DISASSOCIATED workers follow unbound wq cpumask changes
When workqueue cpumask changes are committed, the DISASSOCIATED workers affinity is not touched and this might be a problem down the line for isolated setups when the DISASSOCIATED pools still have works to run after the cpu is offline. Make sure the workers' affinity is updated every time a workqueue cpumask changes, so these workers can't break isolation. Cc: Juri Lelli <[email protected]> Cc: Waiman Long <[email protected]> Signed-off-by: Lai Jiangshan <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent e36bce4 commit 8ac4dbe

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

kernel/workqueue.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6926,13 +6926,26 @@ static int workqueue_apply_unbound_cpumask(const cpumask_var_t unbound_cpumask)
69266926
}
69276927

69286928
if (!ret) {
6929+
int cpu;
6930+
struct worker_pool *pool;
6931+
struct worker *worker;
6932+
69296933
mutex_lock(&wq_pool_attach_mutex);
69306934
cpumask_copy(wq_unbound_cpumask, unbound_cpumask);
69316935
/* rescuer needs to respect cpumask changes when it is not attached */
69326936
list_for_each_entry(wq, &workqueues, list) {
69336937
if (wq->rescuer && !wq->rescuer->pool)
69346938
unbind_worker(wq->rescuer);
69356939
}
6940+
/* DISASSOCIATED worker needs to respect wq_unbound_cpumask */
6941+
for_each_possible_cpu(cpu) {
6942+
for_each_cpu_worker_pool(pool, cpu) {
6943+
if (!(pool->flags & POOL_DISASSOCIATED))
6944+
continue;
6945+
for_each_pool_worker(worker, pool)
6946+
unbind_worker(worker);
6947+
}
6948+
}
69366949
mutex_unlock(&wq_pool_attach_mutex);
69376950
}
69386951
return ret;

0 commit comments

Comments
 (0)