Linux ksmbd Patch Would Distribute SMB Request Processing Across CPUs
In ksmbd, which shares files over the network, each connection has a dedicated thread that receives SMB requests. It queues the requests for worker threads in the kernel to process.
On December 1, 2026, a Linux kernel developer submitted four patches that change how requests are assigned.
The current implementation uses the workqueue for the CPU that the receive thread is on when it queues a request. That makes it easier to take advantage of the CPU cache. But as writes arrive on one connection, receiving and processing them can compete for CPU time.
Even when other CPUs are idle, both tasks can be limited by the capacity of one CPU. The developer identified that as an opportunity to improve throughput.
The proposed approach prefers the CPU that queued the request but lets workers run on other CPUs. One CPU can process an earlier request while the receive thread handles the next one.
Results change with write size
The developer ran fio benchmarks with 128 CPUs available. Storage was tmpfs, a virtual-memory-backed filesystem, and the test used one SMB channel, 16 jobs, and an I/O queue depth of 32, which limits how many requests can be outstanding. The CPU frequency governor was schedutil. The results published on December 1 compare the existing workqueue with the distributed workqueue that prefers the submitting CPU, measuring throughput in MiB/s.
Performance of the proposed ksmbd workqueue (Results published December 1, 2026)
| 128 CPUs, tmpfs (virtual memory), one channel | |||
|---|---|---|---|
| fio, 16 jobs, I/O queue depth 32, schedutil | |||
| Existing → distributed, preferring submitting CPU (MiB/s) / change | |||
| I/O size | Read | Write | 50/50 read-write mix |
| 4KiB | 294 -17.3% | 251 -29.5% | 263 -24.3% |
| 64KiB | 2583 -15.9% | 1640 +22.8% | 2194 -16.4% |
| 256KiB | 3119 +0.2% | 2183 +48.1% | 2906 +11.4% |
| 1MiB | 3398 +0.5% | 2047 +51.0% | 2859 +19.5% |
For 256 KiB writes, throughput rose from 2,183 MiB/s to 3,233 MiB/s. For 1 MiB writes it rose from 2,047 MiB/s to 3,091 MiB/s, a 51% gain. The 1 MiB workload evenly split between reads and writes improved from 2,859 MiB/s to 3,416 MiB/s. Reads alone changed little at that size, from 3,398 MiB/s to 3,413 MiB/s.
The 64 KiB results varied by workload. Writes rose from 1,640 MiB/s to 2,013 MiB/s, while reads fell from 2,583 MiB/s to 2,171 MiB/s. Mixed throughput dropped from 2,194 MiB/s to 1,834 MiB/s.
At 4 KiB, throughput fell for reads, writes, and mixed I/O. Writes fell from 251 MiB/s to 177 MiB/s, and mixed throughput fell from 263 MiB/s to 199 MiB/s.
The developer pointed to the overhead of moving work between CPUs, more send-lock contention for small responses, and the possibility that work could be assigned to a CPU running at a lower frequency.
The value of spreading work across CPUs depends on the read-write mix as well as write size. A design that makes writes faster can be a disadvantage for mixed workloads.
Request size alone is not enough
An October 22 experiment tried using distributed processing only for single-channel writes that met certain conditions, while handling other requests the existing way.
Follow-up results published October 29 show the difficulty. In the experiment, small writes stayed on per-CPU workqueues and only larger writes could run on other CPUs. Performance still fell in a workload mixing 8 KiB and 64 KiB writes.
Small and large requests share the same connection and send lock. Even if separate CPUs handle the writes, they can still contend when sending responses.
The developer also tried letting one worker send several completed responses together. With both distributed processing and batched responses, results depended on how many requests were submitted concurrently.
ksmbd request distribution and CPU frequency scaling (Results published October 29, 2026)
| 1 MiB writes, one channel, one job | ||
|---|---|---|
| Existing → distributed with batched responses (MiB/s) / change | ||
| I/O queue depth | schedutil | performance |
| 1 | 1945.94 -47.52% | 1974.35 -9.58% |
| 2 | 2844.66 -9.75% | 2904.12 +4.63% |
| 4 | 2338.03 +51.73% | 2418.45 +51.33% |
In the October test with 1 MiB writes, one channel, one job, and the schedutil governor, throughput fell from 1,945.94 MiB/s to 1,021.28 MiB/s at queue depth one. At depth four, it rose from 2,338.03 MiB/s to 3,547.42 MiB/s.
With the performance governor on every host CPU, the drop at queue depth one shrank from 47.52% to 9.58%. The developer said frequency scaling amplified the decline at a depth of one.
Even for large writes, the number of requests in flight matters. Request size provides only part of the information needed to choose a workqueue.
A proposed startup setting
The December 1 proposal would let administrators select a workqueue when the server starts and use it for all incoming SMB requests, replacing the earlier experiment's selective handling of writes.
With the corresponding ksmbd-tools changes, administrators could choose the distributed approach in ksmbd.conf by setting server request workqueue = unbound. The value for the existing mode is percpu. Leaving the setting out would retain the current default.
The series also lets kernel modules with GPL-compatible licenses set workqueue attributes and includes other changes to server startup.
The changes address a race in which the server could receive a new start request before it had finished resetting. If transport initialization fails, the current control path would perform the reset directly, avoiding an allocation for a separate recovery work item.
Using more CPUs does not always finish the job sooner
The December 1 benchmarks used tmpfs. Another test used a physical storage device.
On November 16, another developer proposed a patch to select the request workqueue using a module-load parameter. In tests reported November 17, an embedded system with a dual-core Arm CPU wrote to a USB disk over the network. Throughput improved from 178 MB/s to 210 MB/s in one setup and from 215 MB/s to 263 MB/s in another.
The implementation differs from the December proposal, but the results suggest there is room to improve request scheduling even on a two-core device. On a NAS with HDDs or SSDs, the storage and network also matter. Faster CPU processing has less effect when something else limits transfer speed.
The December tests showed large write gains from changing how requests were assigned. File-sharing performance depends on which CPUs do the work as well as how many are available.
On November 30, the developer behind the December proposal said selecting a mode dynamically was complex and needed more implementation work. In the December 1 proposal, the developer said they were investigating how to choose dynamically based on the gains from parallelism and the cost of distributing work. The goal is to outperform both fixed modes across many workloads and make the dynamic mode the default.
An idle CPU is only part of the answer. The question is where work should start and when moving it is worth the cost.
KioskNews shows a cleaned-up reading view extracted from the publisher’s page — the original always lives on their site, not ours.
