mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Chulski <stefan.chulski@broadcom.com>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	Tom Talpey <tom@talpey.com>,
	ChenXiaoSong <chenxiaosong@chenxiaosong.com>,
	linux-cifs@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Stefan Chulski <stefan.chulski@broadcom.com>,
	Ilya Lifshits <ilya.lifshits@broadcom.com>
Subject: [PATCH RFC v1] ksmbd: add use_unbound_wq module parameter for the ksmbd-io workqueue
Date: Mon, 16 Nov 2026 08:48:49 +0100	[thread overview]
Message-ID: <20261116074849.475815-1-stefan.chulski@broadcom.com> (raw)

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@broadcom.com>
---
 Documentation/filesystems/smb/ksmbd.rst | 6 ++++++
 fs/smb/server/ksmbd_work.c              | 9 ++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Documentation/filesystems/smb/ksmbd.rst b/Documentation/filesystems/smb/ksmbd.rst
index 728cfca13205..a045ed6db9b3 100644
--- a/Documentation/filesystems/smb/ksmbd.rst
+++ b/Documentation/filesystems/smb/ksmbd.rst
@@ -158,6 +158,12 @@ How to run
 
 	$ sudo modprobe ksmbd.ko
 
+   - Optional module parameter ``use_unbound_wq`` (default ``0``) makes ksmbd
+     use an unbound workqueue instead of a per-CPU one for request
+     processing, e.g. when CPUs are isolated (``isolcpus=``, ``nohz_full=``).
+
+	$ sudo modprobe ksmbd use_unbound_wq=1
+
 5. Start ksmbd user space daemon
 
 	$ sudo ksmbd.mountd
diff --git a/fs/smb/server/ksmbd_work.c b/fs/smb/server/ksmbd_work.c
index 6e5122e2d6fc..0447b2da84d5 100644
--- a/fs/smb/server/ksmbd_work.c
+++ b/fs/smb/server/ksmbd_work.c
@@ -7,6 +7,7 @@
 #include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
+#include <linux/moduleparam.h>
 
 #include "server.h"
 #include "connection.h"
@@ -18,6 +19,11 @@ static struct kmem_cache *work_cache;
 static struct workqueue_struct *ksmbd_wq;
 static struct workqueue_struct *ksmbd_break_wq;
 
+static bool use_unbound_wq;
+module_param(use_unbound_wq, bool, 0444);
+MODULE_PARM_DESC(use_unbound_wq,
+		 "Use an unbound workqueue for request processing (default: false, per-CPU)");
+
 static int ksmbd_reserve_iov(struct ksmbd_work *work, int need_iov_cnt)
 {
 	struct kvec *new;
@@ -108,7 +114,8 @@ int ksmbd_work_pool_init(void)
 
 int ksmbd_workqueue_init(void)
 {
-	ksmbd_wq = alloc_workqueue("ksmbd-io", WQ_PERCPU, 0);
+	ksmbd_wq = alloc_workqueue("ksmbd-io",
+				   use_unbound_wq ? WQ_UNBOUND : WQ_PERCPU, 0);
 	if (!ksmbd_wq)
 		return -ENOMEM;
 	ksmbd_break_wq = alloc_workqueue("ksmbd-break", WQ_UNBOUND, 0);
-- 
2.54.0


                 reply	other threads:[~2026-11-16  7:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261116074849.475815-1-stefan.chulski@broadcom.com \
    --to=stefan.chulski@broadcom.com \
    --cc=chenxiaosong@chenxiaosong.com \
    --cc=ilya.lifshits@broadcom.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=senozhatsky@chromium.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

all inboxes | Powered by JetHome®