Re: [RFC PATCH 0/2] Add queue_*() functions and prefer per-cpu workqueue and flag
From: Tejun Heo
Date: Wed Jun 24 2026 - 15:47:34 EST
Hello,
On Tue, Jun 23, 2026 at 05:13:31PM +0200, Marco Crivellari wrote:
> > - 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.
>
> You mentioned here "at boot time". What about making this also dynamic,
> "moving" the WQs with WQ_PREFER_PERCPU away from CPU N when N is
> isolated through a cgroup isolated partition?
Yeah, being dynamic is better but switching dynamically between percpu and
unbound workqueues feels like it's going to be complicated. I can't think of
a simple way to do that. If you can, please be my guest.
> I considered checking the flag inside __queue_work(), checking the
> isolated CPU mask to see if the CPU is unbound, and then choosing a
> different CPU accordingly.
>
> I'm also wondering: when an isolated CPU is added / removed, should we
> also act on the work items waiting in the worker pool?
> Should the worker pool be DISASSOCIATED when/if only work items queued
> with WQ_PREFER_PERCPU are on a CPU being isolated? I thought about
> this, and because the worker pool has a list of items queued by
> per-CPU WQs, I don't think it should be disassociated. Maybe I'm
> missing something btw.
I'm not sure overloading DISASSOCIATED with isolated handling is a good
idea. The CPU is still online and there are actual per-cpu work items to
execute there. Maybe you can split only preferred ones into their own pools
and mark them DISASSOCIATED but that sounds rather nasty to me.
Thanks.
--
tejun