Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: hehuiwen <huiwen.he@linux.dev>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: linux-cifs@vger.kernel.org,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Tom Talpey <tom@talpey.com>,
	ChenXiaoSong <chenxiaosong@chenxiaosong.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] ksmbd: splice READ payloads over TCP
Date: Wed, 25 Nov 2026 16:58:23 +0800	[thread overview]
Message-ID: <ec609ac9-c250-4e38-a0d1-9f7ff5252436@linux.dev> (raw)
In-Reply-To: <CAKYAXd_GDhds=X8OgLCU6f6MqtF4A-7fZiQz-829SWSdUKJbdA@mail.gmail.com>

Hi Namjae,

On a single TCP connection, pure per-CPU makes the RX thread and workers 
fight for the same core.

Pure unbound fixes that, but causes other problems: parallel workers 
still contend on srv_mutex and send small replies one by one, cross-CPU
execution hurts locality, and under schedutil spreading the load can 
drop workers onto lower-frequency CPUs (on the 64 KiB READ send path we
saw ~1.97 GHz with per-CPU vs. ~0.9 GHz with unbound). For serial 1-job
QD=1 writes, there is no overlap to benefit from either.

For example(Throughput:MiB/s):

Workload           jobs/QD   PERCPU  UNBOUND   Change
-----------------  -------  -------  -------  -------
1ch, 64 KiB READ     16/32  2051.38  1387.34  -32.37%
1ch,  4 KiB WRITE    16/32   215.82   182.71  -15.34%
1ch,  1 MiB WRITE      1/1  1948.84  1109.46  -43.07%
4ch, 64 KiB WRITE    16/32  2788.42  2497.57  -10.43%
4ch,  1 MiB WRITE    16/32  3482.73  3291.34   -5.50%

So I tried sending only WRITE requests to an unbound workqueue, batching
completed WRITE replies, and only using the unbound queue when WRITEs
actually overlap (keeping serial WRITEs per-CPU). So far, across 
low/high QD, small/large blocks, READ/WRITE/mixed, and multichannel, it 
performs better than per-CPU without introducing the unbound regressions.

However, given how complex the overlap-detection logic is, I'm not
confident enough in its reliability yet and want to see if there's a
simpler way. Right now I'm thinking of keeping a few switchable modes in
ksmbd and picking the one that works best in most cases as the default.
What do you think?

Thanks,
Huiwen

在 2026/11/25 15:29, Namjae Jeon 写道:
> On Tue, Nov 24, 2026 at 10:30 PM Huiwen He <huiwen.he@linux.dev> wrote:
>>
>> From: Huiwen He <hehuiwen@kylinos.cn>
>>
>> ksmbd reads file data into a private response buffer. TCP then copies
>> the payload into an skb. If the reply must be queued, ksmbd also
>> copies the unsent bytes into a queue buffer.
>>
>> This series uses MSG_SPLICE_PAGES to avoid those TCP copies for plain,
>> standalone READs: patch 1 splices the initial TCP send from private
>> pages and a header page fragment, and patch 2 retains references to
>> unsent payload folios on the send queue so the send worker can splice
>> them as well.
>>
>> Summary of fio sequential read results (16 jobs, QD32 per job, SMB3.1.1
>> tmpfs; each column is relative to the preceding commit):
>>
>> Channels  I/O         Throughput change        Host Gcycles/GiB change
>>                       patch 1    patch 2          patch 1    patch 2
>>         1  4 KiB        -0.3%      -0.9%            +1.8%      -1.1%
>>         1  64 KiB      +28.4%      +0.9%           -31.5%      -5.9%
>>         1  256 KiB     +60.8%      +5.3%           -40.5%     -22.5%
>>         1  1 MiB       +51.5%      +9.2%           -33.1%     -32.2%
>>         4  4 KiB        +0.2%      +0.2%            +0.9%      +0.2%
>>         4  64 KiB       +3.9%      +2.6%            -6.9%      +0.8%
>>         4  256 KiB     +12.1%      -0.4%           -43.0%      -0.8%
>>         4  1 MiB       +17.6%      +7.1%           -39.5%     -34.7%
>>
>> Huiwen He (2):
>>    ksmbd: send READ payloads with MSG_SPLICE_PAGES
>>    ksmbd: retain unsent READ pages on the TCP send queue
> I don't see any patch using unbound workqueues in this series. Will
> you send it to the list later ? or need to check it more?
> 
> Thanks.


      reply	other threads:[~2026-11-25  8:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 13:25 [PATCH 0/2] ksmbd: splice READ payloads over TCP Huiwen He
2026-11-24 13:25 ` [PATCH 1/2] ksmbd: send READ payloads with MSG_SPLICE_PAGES Huiwen He
2026-11-24 13:33 ` [PATCH 2/2] ksmbd: retain unsent READ pages on the TCP send queue Huiwen He
2026-11-25  4:29 ` [PATCH 0/2] ksmbd: splice READ payloads over TCP ChenXiaoSong
2026-11-25  7:29 ` Namjae Jeon
2026-11-25  8:58   ` hehuiwen [this message]

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=ec609ac9-c250-4e38-a0d1-9f7ff5252436@linux.dev \
    --to=huiwen.he@linux.dev \
    --cc=chenxiaosong@chenxiaosong.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@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