Re: [PATCH 0/4] ksmbd: allow request dispatch on an unbound workqueue
From: Namjae Jeon
Date: Tue Dec 01 2026 - 17:44:37 EST
On Tue, Dec 1, 2026 at 12:28 PM Huiwen He <huiwen.he@xxxxxxxxx> wrote:
>
> From: Huiwen He <hehuiwen@xxxxxxxxxx>
>
> ksmbd currently dispatches incoming requests to a per-CPU workqueue.
> Pipelined writes on a single connection can leave the receive thread
> and workers competing for the same CPU. An unbound workqueue lets
> workers use other CPUs, but the cost of cross-CPU handoffs can outweigh
> the gain from parallelism.
>
> Patch 1 fixes a race that can let ksmbd accept a new startup request
> before reset finishes restoring the server defaults.
>
> Patch 2 handles startup failures in the current control work item, so
> recovery does not depend on allocating another one.
>
> Patch 3 exports the helpers needed to set CPU scope before sysfs
> registration.
>
> Patch 4 lets ksmbd.mountd select the workqueue for all incoming SMB
> requests at server startup. With the companion ksmbd-tools patch,
> administrators can set "server request workqueue = unbound" in
> ksmbd.conf. The default is "percpu".
>
> Single-channel fio throughput in MiB/s on tmpfs (schedutil, 128 CPUs,
> 16 jobs, iodepth 32, mixed 50/50 read/write). Both unbound scopes are
> non-strict (shard = cache_shard); delta compares unbound (cpu) with
> per-CPU.
>
> Size I/O per-CPU unbound unbound delta
> (shard) (cpu)
> ------------------------------------------------------------
> 4 KiB READ 294 182 243 -17.3%
> 4 KiB WRITE 251 178 177 -29.5%
> 4 KiB MIXED 263 146 199 -24.3%
>
> 64 KiB READ 2583 1791 2171 -15.9%
> 64 KiB WRITE 1640 1882 2013 +22.8%
> 64 KiB MIXED 2194 1503 1834 -16.4%
>
> 256 KiB READ 3119 3012 3127 +0.2%
> 256 KiB WRITE 2183 3155 3233 +48.1%
> 256 KiB MIXED 2906 3213 3239 +11.4%
>
> 1 MiB READ 3398 3259 3413 +0.5%
> 1 MiB WRITE 2047 3032 3091 +51.0%
> 1 MiB MIXED 2859 3367 3416 +19.5%
>
> The October RFC explored using an unbound workqueue for selected
> WRITE requests [1].
>
> As a follow-up, I am looking into an adaptive mode that weighs the
> benefits of parallelism against the costs of spreading work across
> CPUs. The goal is to outperform both fixed modes on most workloads and
> become the default.
>
> [1] https://lore.kernel.org/r/20261022092514.2590010-1-huiwen.he@xxxxxxxxx
>
> Huiwen He (4):
> ksmbd: keep server in RESETTING until defaults are restored
> ksmbd: reset the server directly on startup failure
> workqueue: export attribute and sysfs setup helpers
> ksmbd: add request workqueue mode startup option
Applied them to #ksmbd-for-next.
Thanks!