[PATCH v2 3/3] nvme-core: reduce io pause time when fail over

Chao Leng lengchao at huawei.com
Fri Aug 7 05:06:38 EDT 2020


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 at 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




More information about the Linux-nvme mailing list