Re: [PATCH v2 2/4] Workqueue: add system_dfl_wq

From: Marco Crivellari
Date: Tue Jun 10 2025 - 04:56:35 EST


Hello Lai,

>What is the reason for removing system_unbound_wq? I believe system_unbound_wq
>is a perfectly appropriate and descriptive name for its callers. I’m not opposed
>to system_dfl_wq as long as it will be an alias for system_unbound_wq (or even
>system_percpu_wq, if that can be configured at boot time by sysadim).

The rename to system_dfl_wq is mostly to make sure this is the default wq choice
when per-cpu is not strictly needed.
It has been proposed here, anyhow:

https://lore.kernel.org/all/Z79E_gbWm9j9bkfR@xxxxxxxxxxxxxxx/

>If anyone feels that the term "unbound" in WORK_CPU_UNBOUND is not aligned with
>the "unbound" in system_unbound_wq, I acknowledge that concern. In that case,
>I would prefer to rename WORK_CPU_UNBOUND to WORK_CPU_UNSPECIFIC.

Yes, personally I like the idea.

>Many structures and functions underlying system_unbound_wq already use 'unbound'
>in their names, so simply renaming system_unbound_wq does not increase
>consistentcy.

What if we keep system_unbound_wq and instead of a pr_warn_once we
just redirect this to
system_dfl_wq, when it is used (like in this patchset, in eg. queue_work())?


Thank you!


On Tue, Jun 10, 2025 at 5:04 AM Lai Jiangshan <jiangshanlai@xxxxxxxxx> wrote:
>
> On Mon, Jun 9, 2025 at 6:35 PM Marco Crivellari
> <marco.crivellari@xxxxxxxx> wrote:
> >
> > Currently if a user enqueue a work item using schedule_delayed_work() the
> > used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use
> > WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to
> > schedule_work() that is using system_wq and queue_work(), that makes use
> > again of WORK_CPU_UNBOUND.
> >
> > This lack of consistentcy cannot be addressed without refactoring the API.
> >
> > system_unbound_wq should be the default workqueue so as not to enforce
> > locality constraints for random work whenever it's not required.
> >
> > Adding system_dfl_wq to encourage its use when unbound work should be used.
> >
> > queue_work() / queue_delayed_work() / mod_delayed_work() will now use the
> > new unbound wq: whether the user still use the old wq a warn will be
> > printed along with a wq redirect to the new one.
> >
> > The old system_unbound_wq will be kept for a few release cycles.
> >
>
> Hello, Macro
>
> What is the reason for removing system_unbound_wq? I believe system_unbound_wq
> is a perfectly appropriate and descriptive name for its callers. I’m not opposed
> to system_dfl_wq as long as it will be an alias for system_unbound_wq (or even
> system_percpu_wq, if that can be configured at boot time by sysadim).
>
>
> If anyone feels that the term "unbound" in WORK_CPU_UNBOUND is not aligned with
> the "unbound" in system_unbound_wq, I acknowledge that concern. In that case,
> I would prefer to rename WORK_CPU_UNBOUND to WORK_CPU_UNSPECIFIC.
>
>
> Many structures and functions underlying system_unbound_wq already use 'unbound'
> in their names, so simply renaming system_unbound_wq does not increase
> consistentcy.
>
> Thanks
> Lai



--

Marco Crivellari

L3 Support Engineer, Technology & Product




marco.crivellari@xxxxxxxx