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.
Showing the changes to kernel/workqueue.c (1 of 1 file). Show all
Unified · Split
| @@ -6926,6 +6926,10 @@ static int workqueue_apply_unbound_cpumask(const cpumask_var_t unbound_cpumask) · 6925 unmodified lines | |||
| 6926 | } | 6926 | } |
| 6927 | 6927 | ||
| 6928 | if (!ret) { | 6928 | if (!ret) { |
| 6929 | int cpu; | ||
| 6930 | struct worker_pool *pool; | ||
| 6931 | struct worker *worker; | ||
| 6932 | |||
| 6929 | mutex_lock(&wq_pool_attach_mutex); | 6933 | mutex_lock(&wq_pool_attach_mutex); |
| 6930 | cpumask_copy(wq_unbound_cpumask, unbound_cpumask); | 6934 | cpumask_copy(wq_unbound_cpumask, unbound_cpumask); |
| 6931 | /* rescuer needs to respect cpumask changes when it is not attached */ | 6935 | /* 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 | |||
| 6933 | if (wq->rescuer && !wq->rescuer->pool) | 6937 | if (wq->rescuer && !wq->rescuer->pool) |
| 6934 | unbind_worker(wq->rescuer); | 6938 | unbind_worker(wq->rescuer); |
| 6935 | } | 6939 | } |
| 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 | } | ||
| 6936 | mutex_unlock(&wq_pool_attach_mutex); | 6949 | mutex_unlock(&wq_pool_attach_mutex); |
| 6937 | } | 6950 | } |
| 6938 | return ret; | 6951 | return ret; |