]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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)
committerSasha Levin <sasha.levin@oracle.com>
Fri, 4 Mar 2016 15:25:41 +0000 (10:25 -0500)
commitd3c4dd8843bef1885fabaa9f61d5d354ec2a5e3a
tree656b9e9961b69fae342c4b62d64d8a543a95d007
parent9e1a3771b412f52694e22a93cf188dbe9f0eab24
workqueue: wq_pool_mutex protects the attrs-installation

[ Upstream commit 5b95e1af8d17d85a17728f6de7dbff538e6e3c49 ]

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>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
kernel/workqueue.c