The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Huiwen He <huiwen.he@linux.dev>
To: linkinjeon@kernel.org
Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org,
	senozhatsky@chromium.org, tom@talpey.com,
	chenxiaosong@chenxiaosong.com, tj@kernel.org,
	jiangshanlai@gmail.com, stefan.chulski@broadcom.com
Subject: [PATCH 0/4] ksmbd: allow request dispatch on an unbound workqueue
Date: Tue,  1 Dec 2026 11:27:44 +0800	[thread overview]
Message-ID: <20261201032749.2224354-1-huiwen.he@linux.dev> (raw)

From: Huiwen He <hehuiwen@kylinos.cn>

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@linux.dev

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

 fs/smb/server/ksmbd_netlink.h |  8 ++++-
 fs/smb/server/ksmbd_work.c    | 64 +++++++++++++++++++++++++++++++++--
 fs/smb/server/ksmbd_work.h    |  3 +-
 fs/smb/server/server.c        | 27 +++++++++------
 fs/smb/server/server.h        |  4 ++-
 fs/smb/server/transport_ipc.c |  5 +++
 kernel/workqueue.c            |  4 +++
 7 files changed, 100 insertions(+), 15 deletions(-)


base-commit: 87ff512becd45a08c44fd47a9f03e607af9ef6bd

             reply	other threads:[~2026-12-01  3:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  3:27 Huiwen He [this message]
2026-12-01  3:27 ` [PATCH 1/4] ksmbd: keep server in RESETTING until defaults are restored Huiwen He
2026-12-01  3:27 ` [PATCH 2/4] ksmbd: reset the server directly on startup failure Huiwen He
2026-12-01  3:27 ` [PATCH 3/4] workqueue: export attribute and sysfs setup helpers Huiwen He
2026-12-01  3:27 ` [PATCH 4/4] ksmbd: add request workqueue mode startup option Huiwen He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201032749.2224354-1-huiwen.he@linux.dev \
    --to=huiwen.he@linux.dev \
    --cc=chenxiaosong@chenxiaosong.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=stefan.chulski@broadcom.com \
    --cc=tj@kernel.org \
    --cc=tom@talpey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox