From: sashiko-bot@kernel.org
To: "Seiji Nishikawa" <snishika@redhat.com>
Cc: linux-nvme@lists.infradead.org
Subject: Re: [RFC PATCH 1/2] nvme-tcp: remove the direct send path
Date: Sun, 22 Nov 2026 01:42:49 +0000 [thread overview]
Message-ID: <sashiko-outbox-227628@kernel.org> (raw)
In-Reply-To: <20261122011826.1959697-2-snishika@redhat.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] nvme-tcp: poll queue starvation and latency regression in
nvme_tcp_queue_request()
--
commit 7f6babf6da3e0f7ca956d6a355e996efe6f74e66
Author: Seiji Nishikawa <snishika@redhat.com>
nvme-tcp: remove the direct send path
This commit removes the inline direct send path in nvme_tcp_queue_request()
and nvme_tcp_send_all(), deferring all request transmissions to
queue->io_work on nvme_tcp_wq.
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index 62a594b8ab9bf..2b832ac3068a9 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
[ ... ]
> @@ -446,28 +435,10 @@ static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req,
> bool last)
> {
> struct nvme_tcp_queue *queue = req->queue;
> - bool empty;
>
> - empty = llist_add(&req->lentry, &queue->req_list) &&
> - list_empty(&queue->send_list) && !queue->request;
> -
> - /*
> - * if we're the first on the send_list and we can try to send
> - * directly, otherwise queue io_work. Also, only do that if we
> - * are on the same cpu, so we don't introduce contention.
> - *
> - * TLS kTLS send takes ctx->tx_lock while blk_mq holds set->srcu.
> - * lockdep reports circular locking via elevator_lock. Defer TLS
> - * sends to the io workqueue instead of inline from this path.
> - */
> - if (queue->io_cpu == raw_smp_processor_id() &&
> - !nvme_tcp_queue_tls(queue) &&
> - empty && mutex_trylock(&queue->send_mutex)) {
> - nvme_tcp_send_all(queue);
> - mutex_unlock(&queue->send_mutex);
> - }
> + llist_add(&req->lentry, &queue->req_list);
>
> - if (last && nvme_tcp_queue_has_pending(queue))
> + if (last)
> queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work);
> }
[Severity: Medium]
Does removing the inline send from nvme_tcp_queue_request() break polled
I/O on HCTX_TYPE_POLL queues?
nvme_tcp_set_queue_io_cpu() binds queue->io_cpu for a poll queue to a CPU
in set->map[HCTX_TYPE_POLL].mq_map, while nvme_tcp_poll() only polls the
receive side and never drains queue->req_list:
drivers/nvme/host/tcp.c:nvme_tcp_poll() {
...
set_bit(NVME_TCP_Q_POLLING, &queue->flags);
if (sk_can_busy_loop(sk) && skb_queue_empty_lockless(&sk->sk_receive_queue))
sk_busy_loop(sk, true);
ret = nvme_tcp_try_recv(queue);
clear_bit(NVME_TCP_Q_POLLING, &queue->flags);
...
}
Previously, a task submitting and polling on queue->io_cpu sent the
request inline when the queue was idle and completed it without waking
nvme_tcp_wq. With all sends deferred to queue->io_work on queue->io_cpu,
a SCHED_FIFO or SCHED_RR task polling via io_uring IORING_SETUP_IOPOLL or
blk_execute_rq() on queue->io_cpu starves the SCHED_NORMAL nvme_tcp_wq
worker on the same CPU and spins in nvme_tcp_poll() waiting for a request
still sitting in queue->req_list until RT throttling or the 30-second
NVMe I/O timeout fires. For SCHED_NORMAL tasks on queue->io_cpu, waking
the WQ_HIGHPRI worker sets TIF_NEED_RESCHED, causing blk_hctx_poll() and
io_iopoll_check() to abort polling on need_resched() or forcing two
context switches per polled I/O.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261122011826.1959697-1-snishika@redhat.com?part=1
next prev parent reply other threads:[~2026-11-22 1:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 1:18 [RFC PATCH 0/2] nvme-tcp: remove the direct send path Seiji Nishikawa
2026-11-22 1:18 ` [RFC PATCH 1/2] " Seiji Nishikawa
2026-11-22 1:42 ` sashiko-bot [this message]
2026-11-22 4:37 ` Seiji Nishikawa
2026-11-23 8:20 ` Hannes Reinecke
2026-11-22 1:18 ` [RFC PATCH 2/2] nvme-tcp: remove send_mutex Seiji Nishikawa
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=sashiko-outbox-227628@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sashiko-reviews@lists.linux.dev \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.