The Common Internet File System (CIFS) as an implementation of the SMB protocol for commonly sharing files with Windows systems will enjoy better read performance with the Linux 6.14 kernel.
As part of the various VFS pull requests sent out last week, Microsoft engineer Christian Brauner sent out the VFS NETFS updates for Linux 6.14 that contain an interesting set of improvements from David Howells. The patches benefit the read performance for CIFS as well as AFS (Andrew File System).
The read performance improvements for CIFS in Linux 6.14 are described as:
“The read performance improvements are intended to speed up some loss of performance detected in cifs and to a lesser extend in afs. The problem is that we queue too many work items during the collection of read results: each individual subrequest is collected by its own work item, and then they have to interact with each other when a series of subrequests don’t exactly align with the pattern of folios that are being read by the overall request.
Whilst the processing of the pages covered by individual subrequests as they complete potentially allows folios to be woken in parallel and with minimum delay, it can shuffle wakeups for sequential reads out of order – and that is the most common I/O pattern.
The final assessment and cleanup of an operation is then held up until the last I/O completes – and for a synchronous sequential operation, this means the bouncing around of work items just adds latency.
Two changes have been made to make this work:
(1) All collection is now done in a single “work item” that works progressively through the subrequests as they complete (and also dispatches retries as necessary).
(2) For readahead and AIO, this work item be done on a workqueue and can run in parallel with the ultimate consumer of the data; for synchronous direct or unbuffered reads, the collection is run in the application thread and not offloaded.
Functions such as smb2_readv_callback() then just tell netfslib that the subrequest has terminated; netfslib does a minimal bit of processing on the spot – stat counting and tracing mostly – and then queues/wakes up the worker. This simplifies the logic as the collector just walks sequentially through the subrequests as they complete and walks through the folios, if buffered, unlocking them as it goes. It also keeps to a minimum the amount of latency injected into the filesystem’s low-level I/O handling
The way netfs supports filesystems using the deprecated PG_private_2 flag is changed: folios are flagged and added to a write request as they complete and that takes care of scheduling the writes to the cache. The originating read request can then just unlock the pages whatever happens.”
This same pull request also brings single-blob object support for which the content of the file must be read from or written to the server in a single operation.
More details on these improvements for Linux 6.14 via this pull request of the code that has since been merged to mainline.