linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 3/3] nvme-core: reduce io pause time when fail over
@ 2020-08-07  9:06 Chao Leng
  0 siblings, 0 replies; only message in thread
From: Chao Leng @ 2020-08-07  9:06 UTC (permalink / raw)
  To: linux-nvme, linux-block; +Cc: kbusch, axboe, hch, sagi, lengchao

We test nvme over roce fail over with multipath when 1000 namespaces
configured, io pause more than 10 seconds. The reason: nvme_stop_queues
will quiesce all queues for each namespace when io timeout cause path
error. Quiesce queue wait all ongoing dispatches finished through
synchronize_rcu, need more than 10 milliseconds for each wait,
thus io pause more than 10 seconds.

To reduce io pause time, we introduce async mechanism for sync SRCU
and quiesce queue. In nvme_stop_queues, we can first call
blk_mq_quiesce_queue_async, and then blk_mq_quiesce_queue_async_wait,
thus reduce serial quiesce queue wait time. Cancel io will quickly,
multipath will fail over to retry quickly.

Signed-off-by: Chao Leng <lengchao@huawei.com>
---
 drivers/nvme/host/core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c2c5bc4fb702..2716ba89bffa 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4313,11 +4313,16 @@ EXPORT_SYMBOL_GPL(nvme_start_freeze);
 void nvme_stop_queues(struct nvme_ctrl *ctrl)
 {
 	struct nvme_ns *ns;
+	atomic_t count;
+
+	atomic_set(&count, 0);
 
 	down_read(&ctrl->namespaces_rwsem);
 	list_for_each_entry(ns, &ctrl->namespaces, list)
-		blk_mq_quiesce_queue(ns->queue);
+		blk_mq_quiesce_queue_async(ns->queue, &count);
 	up_read(&ctrl->namespaces_rwsem);
+
+	blk_mq_quiesce_queue_async_wait(&count);
 }
 EXPORT_SYMBOL_GPL(nvme_stop_queues);
 
-- 
2.16.4


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

only message in thread, other threads:[~2020-08-07  9:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07  9:06 [PATCH v2 3/3] nvme-core: reduce io pause time when fail over Chao Leng

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