History

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.

Lai Jiangshan committed 12 months ago

Commit 8ac4dbe1 parent e36bce41 file · +13 −0Browse files

Showing the changes to kernel/workqueue.c (1 of 1 file). Show all

Unified · Split

kernel/workqueue.c+13−0
@@ -6926,6 +6926,10 @@ static int workqueue_apply_unbound_cpumask(const cpumask_var_t unbound_cpumask) · 6925 unmodified lines
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 */
@@ -6933,6 +6937,15 @@ static int workqueue_apply_unbound_cpumask(const cpumask_var_t unbound_cpumask) · 1 unmodified line
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;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t