]> git.baikalelectronics.ru Git - kernel.git/commit
workqueue: Protects wq_unbound_cpumask with wq_pool_attach_mutex
authorLai Jiangshan <jiangshan.ljs@antgroup.com>
Thu, 12 Jan 2023 16:14:27 +0000 (16:14 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:32:53 +0000 (09:32 +0100)
commit775026001e7b3afe8bebed015c137b11f1e7218c
tree3732b6a00cfb9c66188c5f4e92693591be5d0ca5
parentc9d9331a397728e037678c71c4292061d2187de2
workqueue: Protects wq_unbound_cpumask with wq_pool_attach_mutex

[ Upstream commit 7263795597cd39fed36f0413b513c87e4b1b0e96 ]

When unbind_workers() reads wq_unbound_cpumask to set the affinity of
freshly-unbound kworkers, it only holds wq_pool_attach_mutex. This isn't
sufficient as wq_unbound_cpumask is only protected by wq_pool_mutex.

Make wq_unbound_cpumask protected with wq_pool_attach_mutex and also
remove the need of temporary saved_cpumask.

Fixes: 264fd0e7caf0 ("workqueue: Restrict kworker in the offline CPU pool running on housekeeping CPUs")
Reported-by: Valentin Schneider <vschneid@redhat.com>
Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/workqueue.c