From: Hannes Reinecke <hare@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@kernel.org>, Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org, Hannes Reinecke <hare@kernel.org>,
Chris Leech <cleech@redhat.com>
Subject: [PATCH 2/2] nvme-tcp: fix I/O stalls on congested sockets
Date: Tue, 29 Apr 2025 10:17:39 +0200 [thread overview]
Message-ID: <20250429081739.44820-3-hare@kernel.org> (raw)
In-Reply-To: <20250429081739.44820-1-hare@kernel.org>
When the socket is busy processing nvme_tcp_try_recv() might
return -EAGAIN, but this doesn't automatically imply that
the sending side is blocked, too.
So check if there are pending requests once nvme_tcp_try_recv()
returns -EAGAIN and continue with the sending loop to avoid
I/O stalls.
Acked-by: Chris Leech <cleech@redhat.com>
Signed-off-by: Hannes Reinecke <hare@kernel.org>
---
drivers/nvme/host/tcp.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 1c39a307456c..eb4222c5a77a 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1361,7 +1361,7 @@ static int nvme_tcp_try_recv(struct nvme_tcp_queue *queue)
queue->nr_cqe = 0;
consumed = sock->ops->read_sock(sk, &rd_desc, nvme_tcp_recv_skb);
release_sock(sk);
- return consumed;
+ return consumed == -EAGAIN ? 0 : consumed;
}
static void nvme_tcp_io_work(struct work_struct *w)
@@ -1389,6 +1389,11 @@ static void nvme_tcp_io_work(struct work_struct *w)
else if (unlikely(result < 0))
return;
+ /* did we get some space after spending time in recv? */
+ if (nvme_tcp_queue_has_pending(queue) &&
+ sk_stream_is_writeable(queue->sock->sk))
+ pending = true;
+
if (!pending || !queue->rd_enabled)
return;
--
2.35.3
next prev parent reply other threads:[~2025-04-29 8:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-29 8:17 [PATCHv5 0/2] nvme-tcp: fixup I/O stall on congested sockets Hannes Reinecke
2025-04-29 8:17 ` [PATCH 1/2] nvme-tcp: sanitize request list handling Hannes Reinecke
2025-04-29 9:12 ` Sagi Grimberg
2025-04-29 8:17 ` Hannes Reinecke [this message]
2025-04-29 9:13 ` [PATCH 2/2] nvme-tcp: fix I/O stalls on congested sockets Sagi Grimberg
2025-04-29 11:31 ` Hannes Reinecke
-- strict thread matches above, loose matches on Subject: below --
2025-04-28 6:50 [PATCHv4 0/2] nvme-tcp: fixup I/O stall " Hannes Reinecke
2025-04-28 6:50 ` [PATCH 2/2] nvme-tcp: fix I/O stalls " Hannes Reinecke
2025-04-28 11:24 ` Sagi Grimberg
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=20250429081739.44820-3-hare@kernel.org \
--to=hare@kernel.org \
--cc=cleech@redhat.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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.