Re: [PATCH RFC v1] ksmbd: add use_unbound_wq module parameter for the ksmbd-io workqueue
From: Stefan Chulski
Date: Mon Nov 16 2026 - 07:52:57 EST
On Mon, Nov 16, 2026 at 2:10 PM Namjae Jeon <linkinjeon@xxxxxxxxxx> wrote:
>
> On Mon, Nov 16, 2026 at 4:49 PM Stefan Chulski
> <stefan.chulski@xxxxxxxxxxxx> wrote:
> >
> > The "ksmbd-io" workqueue has always been per-CPU. Commit 69635d7f4b34
> > ("fs: WQ_PERCPU added to alloc_workqueue users") only made that
> > default explicit as part of the treewide transition to unbound-by-default;
> > it was not a ksmbd-specific decision.
> >
> > Per-CPU work keeps request processing on the CPU that queued it, which
> > is good for cache locality, but it also runs work on CPUs that were
> > isolated from workqueue noise (isolcpus=, nohz_full=) and prevents the
> > scheduler from placing blocked or long-running workers elsewhere.
> > Which behaviour is better depends on the workload and platform.
> >
> > Add a boolean use_unbound_wq module parameter. It defaults to false, so
> > behaviour is unchanged unless it is set; when true, "ksmbd-io" is
> > allocated with WQ_UNBOUND instead of WQ_PERCPU. The "ksmbd-break"
> > workqueue is already WQ_UNBOUND and is not affected.
> >
> > Document the parameter in ksmbd.rst.
> >
> > Signed-off-by: Stefan Chulski <stefan.chulski@xxxxxxxxxxxx>
> Hi Stefan,
>
> Do you have numbers comparing the per-CPU and unbound queues,
Yes, on our systems we observed up to an 18% performance improvement
when using the unbound workqueue.
The primary reason for this improvement is that with the default
per-CPU workqueue, ksmbd-io work can sometimes start on a CPU that is
already heavily loaded. Because it is bound to that specific CPU, the
scheduler cannot move it to a less loaded or idle CPU, leading to
bottlenecks. By using WQ_UNBOUND, the scheduler is free to migrate the
work to less loaded CPUs, which significantly improves our CPU cycle
efficiency.
> How does this compare with the earlier following RFC ?
>
> https://lore.kernel.org/linux-cifs/20261022092514.2590010-1-huiwen.he@xxxxxxxxx/
>
> Thanks.
While both address the underlying scheduling limitations of per-CPU
workqueues for ksmbd, my patch introduces the `use_unbound_wq` module
parameter rather than changing the behavior unconditionally. Because
the optimal behavior (cache locality vs. load balancing) heavily
depends on the specific workload and platform, this approach keeps the
existing per-CPU behavior as the default while allowing platforms to
easily opt-in to the unbound workqueue when it yields better
performance.
Thanks,
Stefan
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature