linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Wagner <dwagner@suse.de>
To: linux-nvme@lists.infradead.org
Cc: Sagi Grimberg <sagi@grimberg.me>, Keith Busch <kbusch@kernel.org>,
	Daniel Wagner <dwagner@suse.de>, Hannes Reinecke <hare@suse.de>
Subject: [PATCH v2] nvme-tcp: send quota for nvme_tcp_send_all()
Date: Mon, 24 Oct 2022 17:03:34 +0200	[thread overview]
Message-ID: <20221024150334.29215-1-dwagner@suse.de> (raw)

Add a send quota in nvme_tcp_send_all() to avoid stalls when sending
large amounts of requests.

Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---

IMO, this patch might still be a good idea to add. At least in my test
setup where I only have one ethernet port it makes a big difference
when accessing the system via ssh. When nvme-tcp is pushing a lot of
data via the network, the ssh session is completely blocked by the
storage traffic. With it, the ssh session stays responsive.

I suspect a proper storage setup would use more than one ethernet
port.

Daniel

v1:
  https://lore.kernel.org/linux-nvme/20220519062617.39715-4-hare@suse.de/

 drivers/nvme/host/tcp.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 3e7b29d07c71..84a66ca208c8 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -308,12 +308,23 @@ static inline void nvme_tcp_advance_req(struct nvme_tcp_request *req,
 
 static inline void nvme_tcp_send_all(struct nvme_tcp_queue *queue)
 {
-	int ret;
+	unsigned long deadline = jiffies + msecs_to_jiffies(1);
 
 	/* drain the send queue as much as we can... */
 	do {
-		ret = nvme_tcp_try_send(queue);
-	} while (ret > 0);
+		bool pending = false;
+		int result;
+
+		result = nvme_tcp_try_send(queue);
+		if (result > 0)
+			pending = true;
+		else if (unlikely(result < 0))
+			return;
+
+		if (!pending)
+			return;
+
+	} while (!time_after(jiffies, deadline)); /* quota is exhausted */
 }
 
 static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue)
-- 
2.38.0



             reply	other threads:[~2022-10-24 15:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24 15:03 Daniel Wagner [this message]
2022-10-25  0:54 ` [PATCH v2] nvme-tcp: send quota for nvme_tcp_send_all() Chaitanya Kulkarni
2022-10-25  5:52   ` Daniel Wagner
2022-10-25  7:09   ` Hannes Reinecke
2022-10-25 13:46     ` Sagi Grimberg
2022-10-26  7:13       ` Daniel Wagner
2022-10-26  8:30         ` Sagi Grimberg
2022-10-26  8:39           ` Daniel Wagner
2022-10-25  6:37 ` Hannes Reinecke

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=20221024150334.29215-1-dwagner@suse.de \
    --to=dwagner@suse.de \
    --cc=hare@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).