summaryrefslogtreecommitdiff
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorBreno Leitao <leitao@debian.org>2026-08-19 07:37:35 -0700
committerTejun Heo <tj@kernel.org>2026-08-31 12:07:57 -1000
commit8386ed68ae041b4d0919d851ec5300e41c1c2195 (patch)
tree9d1150e8b012fe2d11d5a5f1f9b7e37c0a84f305 /kernel/workqueue.c
parent93e257938aa67a6c957217db94091d9d9e5d403f (diff)
downloadlinux-next-8386ed68ae041b4d0919d851ec5300e41c1c2195.tar.gz
linux-next-8386ed68ae041b4d0919d851ec5300e41c1c2195.zip
workqueue: move the unbound-only attrs check to apply_workqueue_attrs()
apply_workqueue_attrs_locked() refuses any workqueue without WQ_UNBOUND. That is the right rule for changing a workqueue's attributes, but it also blocks the internal callers, and building a percpu workqueue's pwq table through this path needs them. Move the check into apply_workqueue_attrs(), the exported entry point, which is the one that changes attributes on a live workqueue. Signed-off-by: Breno Leitao <leitao@debian.org> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index b8bec1689b7a..acd985ae2ac6 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5577,10 +5577,6 @@ static int apply_workqueue_attrs_locked(struct workqueue_struct *wq,
{
struct apply_wqattrs_ctx *ctx;
- /* only unbound workqueues can change attributes */
- if (WARN_ON(!(wq->flags & WQ_UNBOUND)))
- return -EINVAL;
-
ctx = apply_wqattrs_prepare(wq, attrs, wq_unbound_cpumask);
if (IS_ERR(ctx))
return PTR_ERR(ctx);
@@ -5612,6 +5608,10 @@ int apply_workqueue_attrs(struct workqueue_struct *wq,
{
int ret;
+ /* only unbound workqueues can change attributes */
+ if (WARN_ON(!(wq->flags & WQ_UNBOUND)))
+ return -EINVAL;
+
mutex_lock(&wq_pool_mutex);
ret = apply_workqueue_attrs_locked(wq, attrs);
mutex_unlock(&wq_pool_mutex);