[PATCH v2 0/9] workqueue: base pwq pool release and nr_active on the backing pool

From: Breno Leitao

Date: Wed Aug 05 2026 - 10:57:51 EST


The goal is to unify per-cpu and unbound workqueues onto one backend, so
an unbound workqueue can run on the concurrency-managed per-cpu pools and
WQ_PERCPU just requests that backend [1]. This series is preparation and
changes no behaviour on its own.

These changes also is a reasonable readability cleanup.

Design principles, as discussed in [2].

a) There is one workqueue implementation -- what is today the unbound one --
and percpu becomes one of its affinity settings rather than a separate
type. The unbound_* helper names get renamed/removed once they stop
being unbound-specific. So, `alloc_unbound_pwq()` becomes
`alloc_pwq` and handle both cases.

b) There is one pwq path, and alloc_and_link_percpu_pwqs() goes away.

c) Which pool backs a pwq becomes a property of the attrs, resolved in
alloc_unbound_pwq(), which hands out either the static percpu pool for
that CPU or a hashed unbound one.

d) Both pool types stay -- concurrency management only exists on the percpu
ones -- so what gets merged is the machinery, not the pools.

e) This is the prep phase for the changes that will come once we are
happy with these changes.

What will come later:

* Introduce a concurrency-managed per-cpu affinity scope
(WQ_AFFN_PERCPU) — percpu as an affinity setting

* Direct pool selection (fold the create-then-convert),

* Dynamic switching between per-cpu and unbound backing for CPU isolation.

[1] https://lore.kernel.org/all/ak569WYSm3ygKl1-@xxxxxxxxxxxxxxx
[2] https://lore.kernel.org/all/anDImojbi6lq0zUg@xxxxxxxxxxxxxxx/

Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
---
Changes in v2:
- Removed the ugly __WQ_PERCPU_POOLS
- Renamed some helpers here and there
- additional patches, removing the "unbound" from function names
- Link to v1: https://patch.msgid.link/20260731-wq-pool-refactor-v1-0-8eaf71cdab5f@xxxxxxxxxx

---
Breno Leitao (9):
workqueue: factor out get_percpu_pool()
workqueue: factor out alloc_and_link_percpu_pwqs()
workqueue: release pwq pools by pool type
workqueue: account nr_active by the backing pool
workqueue: test WQ_UNBOUND explicitly in the hotplug loops
workqueue: rename wq->unbound_attrs to wq->attrs
workqueue: allocate attrs for all workqueues
workqueue: rename alloc_unbound_pwq() to alloc_pwq()
workqueue: skip the node_nr_active update for non-unbound workqueues

kernel/workqueue.c | 166 +++++++++++++++++++++++++--------------------
tools/workqueue/wq_dump.py | 6 +-
2 files changed, 96 insertions(+), 76 deletions(-)
---
base-commit: dbff1ec23f68640a743512e8ada125795d1b72c7
change-id: 20260729-wq-pool-refactor-0fb28721f83f

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