]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
workqueue: Move pwq->max_active to wq->max_active
authorTejun Heo <tj@kernel.org>
Mon, 29 Jan 2024 18:11:24 +0000 (08:11 -1000)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:19:16 +0000 (18:19 -0400)
commit82e098f5bed1ff167332d26f8551662098747ec4
tree998d17dceaaac3c713b9f627505c0e4f8e662c3f
parent43a181f8f41aca27e7454cf44a6dfbccc8b14e92
workqueue: Move pwq->max_active to wq->max_active

[ Upstream commit a045a272d887575da17ad86d6573e82871b50c27 ]

max_active is a workqueue-wide setting and the configured value is stored in
wq->saved_max_active; however, the effective value was stored in
pwq->max_active. While this is harmless, it makes max_active update process
more complicated and gets in the way of the planned max_active semantic
updates for unbound workqueues.

This patches moves pwq->max_active to wq->max_active. This simplifies the
code and makes freezing and noop max_active updates cheaper too. No
user-visible behavior change is intended.

As wq->max_active is updated while holding wq mutex but read without any
locking, it now uses WRITE/READ_ONCE(). A new locking locking rule WO is
added for it.

v2: wq->max_active now uses WRITE/READ_ONCE() as suggested by Lai.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Lai Jiangshan <jiangshanlai@gmail.com>
Stable-dep-of: 5797b1c18919 ("workqueue: Implement system-wide nr_active enforcement for unbound workqueues")
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/workqueue.c