Re: [PATCH] workqueue: Always use wq_select_unbound_cpu() for WORK_CPU_UNBOUND.

From: Tejun Heo
Date: Wed Apr 02 2025 - 14:16:37 EST


Hello, Frederic.

On Wed, Apr 02, 2025 at 06:40:47PM +0200, Frederic Weisbecker wrote:
> > If we're renaming, I'd deprecate the schedule_*() interface and always use
> > queue_*() and maybe:
> >
> > - Replace WQ_UNBOUND with its complement WQ_PERCPU.
>
> This one scares us a bit. Currently the default for alloc_workqueue() is
> WQ_PERCPU. After that the default will be the reverse. Even if this
> happens as a single patch treewide change, there will be conflicts
> in the merge window with new users coming up that will happen to be
> unbound whenever they were not intended to.
>
> But there is a way out of that if we are patient:
>
> 1) For one release, do a treewide change that introduces WQ_PERCPU and apply
> it to all relevant users. Keep WQ_UNBOUND around for now and warn if neither
> WQ_PERCPU nor WQ_UNBOUND has been passed (this and grep/coccinelle will catch
> missed patches from other trees after the merge window).
>
> 2) Once that complete, remove WQ_UNBOUND and its uses on the next release.
>
> How does that sound?

Yeah, that sounds way safer.

> > - Add WQ_PREFER_PERCPU.
>
> This can be done afterward case by case.
>
> > - Rename system_wq -> system_percpu_wq.
> > - Add system_prefer_percpu_wq.
> > - Rename system_unbound_wq -> system_dfl_wq.
>
> Easy steps.

Sounds great to me.

Thanks.

--
tejun