[PATCH RFC 0/3] workqueue: Take the pwq backend from the attrs

From: Breno Leitao

Date: Fri Sep 18 2026 - 10:34:21 EST


>From the top of the mountain, Tejun said [1]:

WQ_PERCPU would indicate that the wq must stay per-cpu for correctness,
and we'd also want to allow concurrency management to workqueues which
want to be percpu for performance reasons but can be switched into other
affinity scopes for isolation, so it should move together with whether
the backend needs concurrency management or not instead of WQ_PERCPU
expressed at creation time.

This is an RFC patchset that tries to translate that into opinionated
code.

Design principles:

* Keep wq->max_active and wq->percpu_max_active both current. The two
backends meter work differently, and a pwq must not end up metered
against a limit nobody set. (this is the semi-conflictual with my previous
commit 27db9dd7f84f3a ("workqueue: Give percpu workqueues their own
max_active")

* Create a ->concurrency_managed field in the wq attributes, used to
decide whether to do concurrency management or not.

* Move WQ_PERCPU onto an UNBOUND workqueue with WQ_AFFN_CPU affinity and
the newly created ->concurrency_managed. WQ_PERCPU is then only the
promise that the workqueue stays on that backend.

This is not for acceptance, given this is drastic and it was not tested
enought, it is more to share what I have in mind and get comments from
the community.

Not done: the switching itself. concurrency_managed is fixed when the
workqueue is created and is not exported through sysfs, so nothing takes a
workqueue onto the backend or off it yet. WQ_BH is still its own path
rather than a third backend, the static per-cpu pools are still looked up
outside unbound_pool_hash, and callers still pass WQ_PERCPU rather than
asking for the attrs they want.

Link: https://lore.kernel.org/all/amESSqf0TMmzhFGz@xxxxxxxxxxxxxxx/ [1]

Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
---
Breno Leitao (3):
workqueue: Maintain both max_active limits
workqueue: Add a concurrency_managed workqueue attribute
workqueue: Back every workqueue with the unbound machinery

include/linux/workqueue.h | 10 +++++
kernel/workqueue.c | 107 +++++++++++++++++++++++++++-------------------
2 files changed, 72 insertions(+), 45 deletions(-)
---
base-commit: 9d4815c14f7faf789aeaa63515024168daf0390c
change-id: 20260914-wq_final-bcfbcd3b0f79

Best regards,
--
Breno Leitao <leitao@xxxxxxxxxx>