From: Hannes Reinecke <hare@suse.de>
To: Seiji Nishikawa <snishika@redhat.com>,
Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>
Cc: Chris Leech <cleech@redhat.com>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] nvme-tcp: limit the direct send path to poll queues
Date: Thu, 26 Nov 2026 10:53:09 +0100 [thread overview]
Message-ID: <d812cfe1-f5bb-412b-85d4-a355cc34c848@suse.de> (raw)
In-Reply-To: <20261126063255.3240292-1-snishika@redhat.com>
On 11/26/26 7:32 AM, Seiji Nishikawa wrote:
> nvme_tcp_queue_request() sends the request directly from the submitting
> context when it runs on the io_cpu of the queue, the queue is empty and
> it can take send_mutex. Commit db5ad6b7f8cd ("nvme-tcp: try to send
> request in queue_rq context") added this so that an idle queue can send
> the request without waiting for io_work to run.
>
> Since then this path has needed a series of fixes for races and
> priority inversions between it and io_work. These are
> commit 5c11f7d9f843 ("nvme-tcp: Fix possible race of io_work and direct
> send"), commit a0fdd1418007 ("nvme-tcp: rerun io_work if req_list is
> not empty"), commit 70f437fb4395 ("nvme-tcp: fix io_work priority
> inversion"), commit 08acb54b063a ("nvme-tcp: defer TLS inline send to
> io_work") and commit 5db358f3a7f9 ("nvme-tcp: fix io_work priority
> inversion when send_mutex is held").
>
> On a non-poll queue, the direct send path makes almost no difference to
> the latency. fio with libaio and 4k random I/O at queue depth 1 over a
> 1Gb network, with and without the direct send path (average of 3 runs
> of 60 seconds, latency in usec):
>
> IOPS slat clat lat
> randread with 4153 7.1 232.3 239.3
> without 4154 4.7 234.7 239.4
> randwrite with 2472 24.5 375.6 400.1
> without 2460 14.3 387.6 402.0
>
> lat is slat plus clat. It changes by 0.1 usec for randread and by 1.9
> usec for randwrite.
>
> On a poll queue, the latency becomes worse without the direct send path.
> The submitting task polls for the completion without sleeping. When it
> runs on io_cpu, where io_work also runs, the kworker that runs io_work
> can send the request only after the task is switched out. This happens
> once per request. fio with io_uring and --hipri at queue depth 1 over
> the same network, on the io_cpu of a poll queue (ctx is the number of
> context switches of fio in one run):
>
> IOPS slat clat lat ctx
> randread with 5017 4.72 193.95 198.67 553
> without 4179 9.35 229.70 239.05 251,318
> randwrite with 3619 5.60 269.94 275.54 542
> without 3621 10.62 264.53 275.16 217,806
>
> For randread, lat goes up by 40 usec (20%) without the direct send
> path.
>
> So remove the direct send path, except for poll queues. The other
> queues always send from io_work, as TLS queues already do.
>
> Add a queue flag, NVME_TCP_Q_POLLED, for this. nvme_tcp_alloc_queue()
> sets the flag when the queue is a poll queue, and
> nvme_tcp_queue_request() checks it.
>
> Suggested-by: Hannes Reinecke <hare@suse.de>
> Signed-off-by: Seiji Nishikawa <snishika@redhat.com>
> ---
> Changes since RFC:
> - Keep the direct send path for poll queues. Sashiko pointed out the
> cost on poll queues, and the numbers in the RFC thread confirm it.
> - Drop the patch that removed send_mutex. Poll queues still have 2
> senders, so send_mutex is still needed.
>
> RFC: https://lore.kernel.org/linux-nvme/20261122011826.1959697-1-snishika@redhat.com/
>
> drivers/nvme/host/tcp.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
prev parent reply other threads:[~2026-11-26 9:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 6:32 Seiji Nishikawa
2026-11-26 8:53 ` Christoph Hellwig
2026-11-26 9:53 ` Hannes Reinecke [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=d812cfe1-f5bb-412b-85d4-a355cc34c848@suse.de \
--to=hare@suse.de \
--cc=axboe@kernel.dk \
--cc=cleech@redhat.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--cc=snishika@redhat.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
all inboxes | Powered by JetHome®