workqueue: wq_pool_mutex protects the attrs-installation
authorLai Jiangshan <laijs@cn.fujitsu.com>
Tue, 12 May 2015 12:32:29 +0000 (20:32 +0800)
committerTejun Heo <tj@kernel.org>
Mon, 18 May 2015 20:22:56 +0000 (16:22 -0400)
commit5b95e1af8d17d85a17728f6de7dbff538e6e3c49
treed502e4a59194374a6a94d1e7ec812509b884c51e
parentb749b1b67351bd9be1aa640cadf66d32dfcccfd1
workqueue: wq_pool_mutex protects the attrs-installation

Current wq_pool_mutex doesn't proctect the attrs-installation, it results
that ->unbound_attrs, ->numa_pwq_tbl[] and ->dfl_pwq can only be accessed
under wq->mutex and causes some inconveniences. Example, wq_update_unbound_numa()
has to acquire wq->mutex before fetching the wq->unbound_attrs->no_numa
and the old_pwq.

attrs-installation is a short operation, so this change will no cause any
latency for other operations which also acquire the wq_pool_mutex.

The only unprotected attrs-installation code is in apply_workqueue_attrs(),
so this patch touches code less than comments.

It is also a preparation patch for next several patches which read
wq->unbound_attrs, wq->numa_pwq_tbl[] and wq->dfl_pwq with
only wq_pool_mutex held.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/workqueue.c
This page took 0.026598 seconds and 5 git commands to generate.