Re: [PATCH v4 1/2] workqueue: Make alloc_workqueue() unbound by default
From: Breno Leitao
Date: Fri Oct 16 2026 - 11:56:34 EST
On Thu, Oct 15, 2026 at 04:01:47PM +0200, Marco Crivellari wrote:
> Currently alloc_workqueue() ensure that one among WQ_PERCPU or WQ_UNBOUND
> is present. Now every user has one among these two flags.
>
> In order to achive the future goal of removing WQ_UNBOUND from the code,
> start changing the default behavior making alloc_workqueue() act this way:
>
> - if WQ_PERCPU and WQ_UNBOUND are present: remove WQ_PERCPU (as before)
> - if neither are present: add WQ_UNBOUND
>
> BH workqueues (WQ_BH) are always per-CPU and can't be unbound, so
> WQ_PERCPU is now unconditionally forced for them before the above
> defaulting logic runs.
>
> The WARN_ONCE() when neither flags are present has been removed and it has
> been replaced by pr_warn_once(): from now on, every alloc_users()
> without WQ_PERCPU will be considered unbound.
>
> The pr_warn_once() will be removed along with WQ_UNBOUND in the future.
>
> Link: https://lore.kernel.org/all/20250221112003.1dSuoGyc@xxxxxxxxxxxxx/
> Suggested-by: Tejun Heo <tj@xxxxxxxxxx>
> Signed-off-by: Marco Crivellari <marco.crivellari@xxxxxxxx>
Reviewed-by: Breno Leitao <leitao@xxxxxxxxxx>
> @@ -5895,12 +5895,33 @@ static struct workqueue_struct *__alloc_workqueue(const char *fmt,
> struct workqueue_struct *wq;
> size_t wq_size;
> int name_len;
> + bool wq_unbound_by_default = false;
> + bool wq_dropped_percpu = false;
Nit: I think these declarations would look better in reverse xmas tree
order. I know Tejun doesn't feel strongly about it, so it's just a nit.
--breno