* [PATCH RFC v1] ksmbd: add use_unbound_wq module parameter for the ksmbd-io workqueue
@ 2026-11-16 7:48 Stefan Chulski
0 siblings, 0 replies; only message in thread
From: Stefan Chulski @ 2026-11-16 7:48 UTC (permalink / raw)
To: Namjae Jeon
Cc: Sergey Senozhatsky, Tom Talpey, ChenXiaoSong, linux-cifs,
linux-doc, linux-kernel, Stefan Chulski, Ilya Lifshits
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-16 7:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16 7:48 [PATCH RFC v1] ksmbd: add use_unbound_wq module parameter for the ksmbd-io workqueue Stefan Chulski
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®