linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rfc 1/2] nvmet-tcp: time based stop condition in io_work
@ 2019-09-24 16:06 Wunderlich, Mark
  0 siblings, 0 replies; only message in thread
From: Wunderlich, Mark @ 2019-09-24 16:06 UTC (permalink / raw)
  To: linux-nvme; +Cc: Sagi Grimberg


When network enabled with busy poll have nvmet_tcp_io_work()
do/while loop condition be time based.  Time period set by
sysctl value net.core.busy_read.  Allows for full busy poll
monitoring of recv/send activity during busy_read time period,
and not exiting if a single pass in loop has no activity.

Re-queue the work item if any activity during the complete
busy poll period.

Signed-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
Signed-off-by: Kiran Patil <kiran.patil@intel.com>
Signed-off-by: Mark Wunderlich <mark.wunderlich@intel.com>
---
 drivers/nvme/target/tcp.c |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index bf4f034..a232ef5 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -1167,6 +1167,12 @@ static void nvmet_tcp_io_work(struct work_struct *w)
 		container_of(w, struct nvmet_tcp_queue, io_work);
 	bool pending;
 	int ret, ops = 0;
+#ifdef CONFIG_NET_RX_BUSY_POLL
+	unsigned long deadline, bp_usec;
+
+	bp_usec = READ_ONCE(queue->sock->sk->sk_ll_usec);
+	deadline = jiffies + usecs_to_jiffies(bp_usec);
+#endif /* CONFIG_NET_RX_BUSY_POLL */
 
 	do {
 		pending = false;
@@ -1194,12 +1200,28 @@ static void nvmet_tcp_io_work(struct work_struct *w)
 			return;
 		}
 
+#ifdef CONFIG_NET_RX_BUSY_POLL
+	/* When network fabric is running in busy poll mode
+	 * process for time based quota deadline.
+	 * Do not check pending since we intend to poll for
+	 * activity during complete period.
+	 */
+	} while (!time_after(jiffies, deadline));
+#else
 	} while (pending && ops < NVMET_TCP_IO_WORK_BUDGET);
+#endif /* CONFIG_NET_RX_BUSY_POLL */
 
 	/*
-	 * We exahusted our budget, requeue our selves
+	 * We exhausted our budget, requeue our selves
+	 */
+#ifdef CONFIG_NET_RX_BUSY_POLL
+	/* If there were any ops completed during the complete
+	 * poll loop period then requeue for another round.
 	 */
+	if (ops > 0)
+#else
 	if (pending)
+#endif /* CONFIG_NET_RX_BUSY_POLL */
 		queue_work_on(queue->cpu, nvmet_tcp_wq, &queue->io_work);
 }



_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-24 16:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24 16:06 [PATCH rfc 1/2] nvmet-tcp: time based stop condition in io_work Wunderlich, Mark

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).