Re: [RFC PATCH 0/2] Add queue_*() functions and prefer per-cpu workqueue and flag
From: Tejun Heo
Date: Thu May 07 2026 - 17:30:52 EST
Hello,
On Thu, May 07, 2026 at 12:25:30PM +0200, Marco Crivellari wrote:
> So, either we're going to have an "unbound" version or we use
> queue_work() directly that sounds good to me. I guess retire - in
> future - schedule_work[_on]() would be cleaner: so that users must
> also specify the workqueue they really need to use.
Yeah, retiring would be my preference if we need to update them anyway. I
don't think the thin wrappers add anything useful.
> What do you both think about:
>
> - queue_percpu_work()
> - queue_dfl_work()
But if were to keep the wrappers, yeah, these are better names.
> Let me share where this was discussed a year ago:
>
> https://lore.kernel.org/all/Z79E_gbWm9j9bkfR@xxxxxxxxxxxxxxx/
>
> Perhaps - likely - I haven't understood the WQ_PREFER_PERCPU proposal
> here; I thought it was a workqueue flag, to be used like WQ_PERCPU or
> WQ_UNBOUND.
> Reading Tejun's reply is also clearer now.
Yeah, that was what was discussed then.
> Anyhow, this idea is based on customer reports I've seen previously.
> We noticed that with certain workloads, specific per-cpu work creates
> noise on isolated CPUs. With a flag like that we can identify which
> workqueues prefer to be per-cpu and *not* for correctness. This allows
> using a boot parameter / sysctl, for example, to keep those workqueues
> affined only to housekeeping CPUs.
>
> Of course, if we can achieve the same with a system workqueue (like
> system_prefer_percpu_wq), that would also be fine. I think it would be
> way easier, it should be similar to what we're doing with
> system_power_efficient_wq [1].
WQ_AFFN_CPU is more flexible as the tasks aren't pinned to the CPU but there
may be downsides:
- Concurrency management isn't available.
- Would create more kworkers.
Maybe the original plan can be adapted to:
- Add WQ_PERFER_PERCPU as discussed before.
- At boot time, allow selecting whether to back them with percpu wqs or
WQ_AFFN_X unbound ones. Maybe we can even experiment with default to
WQ_AFFN_CPU.
Thanks.
--
tejun