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

From: Lai Jiangshan
Date: Mon Jun 09 2025 - 23:04:31 EST


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