mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "wang zhaolong" <wangzhaolong@fnnas.com>
To: <linux-cifs@vger.kernel.org>
Cc: <linkinjeon@kernel.org>, <smfrench@gmail.com>,
	 <senozhatsky@chromium.org>, <tom@talpey.com>,
	 <linux-kernel@vger.kernel.org>,
	"Wang Zhaolong" <wangzhaolong@fnnas.com>
Subject: [RFC 0/3] ksmbd: use splice for SMB2 READ responses
Date: Mon, 13 Jul 2026 15:11:37 +0800	[thread overview]
Message-ID: <20260713071141.3909087-1-wangzhaolong@fnnas.com> (raw)

From: Wang Zhaolong <wangzhaolong@fnnas.com>

SMB2 READ currently copies file data into an allocated auxiliary buffer
before sending the response. This series adds a page-backed payload,
collects page-cache data with splice_direct_to_actor(), and sends it after
the SMB response header with MSG_SPLICE_PAGES.

This RFC deliberately limits the new path to plain TCP reads of at least
64 KiB. Signed, encrypted, compressed, compound, RDMA, stream, non-regular,
O_DIRECT and DAX reads continue to use the buffered path. Unsupported
splice collection also falls back before the response owns the payload. If
a socket error occurs after part of a PDU has been sent, the connection is
shut down rather than reusing a corrupted byte stream.

I would particularly appreciate feedback on the work-owned bio_vec payload,
the transport hook, and whether splice_direct_to_actor() is an appropriate
interface for this path.

I tested the series in QEMU with ksmbd and the SMB client in the same
guest. The smb2.read.eof tests passed, including zero-length and
MinimumCount cases. Reads of 65535 bytes used the buffered path, while
65536-byte and 1 MiB reads used the splice payload path. Forced signed and
encrypted 1 MiB reads stayed on the buffered path. All data checks matched
and no kernel warning was observed.

For an exploratory performance comparison, I used a warm 4 GiB file over
SMB 3.1.1 with cache=none, 1 MiB synchronous reads and one job. Median
results across eight valid 60-second samples per kernel were:

                            baseline    patched     delta
  bandwidth                 1.728 GB/s  2.246 GB/s  +30.0%
  mean completion latency   604.1 us    464.5 us    -23.1%
  median sample P99 latency 794.6 us    606.2 us    -23.7%

One patched-kernel sample with TCP retransmissions was discarded by the
validity gate and replaced. These are loopback results; an independent
client is still needed to measure network-path and server CPU effects. The
benchmark candidate preceded the final zero-length READ ordering fix, which
did not change the positive-length payload path exercised here.

Compression, large compound READ, RDMA, stream, non-regular, DAX and
O_DIRECT exclusions, and the unsupported-splice fallback, were not
exercised by this lab.

Wang Zhaolong (3):
  ksmbd: add read payload infrastructure
  ksmbd: add splice-based read payload helper
  ksmbd: use splice payloads for simple SMB2 READ

 fs/smb/server/connection.c    |  25 ++++-
 fs/smb/server/connection.h    |   4 +
 fs/smb/server/ksmbd_work.c    |  45 ++++++++
 fs/smb/server/ksmbd_work.h    |  12 +++
 fs/smb/server/smb2pdu.c       |  67 ++++++++++++
 fs/smb/server/transport_tcp.c |  58 ++++++++++
 fs/smb/server/vfs.c           | 195 ++++++++++++++++++++++++++++++----
 fs/smb/server/vfs.h           |   4 +
 8 files changed, 382 insertions(+), 28 deletions(-)

-- 
2.47.3

             reply	other threads:[~2026-07-13  7:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13  7:11 wang zhaolong [this message]
2026-07-13  7:11 ` [RFC 1/3] ksmbd: add read payload infrastructure wang zhaolong
2026-07-13  7:11 ` [RFC 2/3] ksmbd: add splice-based read payload helper wang zhaolong
2026-07-13  7:11 ` [RFC 3/3] ksmbd: use splice payloads for simple SMB2 READ wang zhaolong
2026-07-13  8:58   ` Namjae Jeon
2026-07-13  9:36     ` Wang Zhaolong
2026-07-17 12:49     ` Wang Zhaolong

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=20260713071141.3909087-1-wangzhaolong@fnnas.com \
    --to=wangzhaolong@fnnas.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=smfrench@gmail.com \
    --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