Skip to contentSkip to conversation

nvme-multipath: queue-depth support for marginal paths

PATCH Superseded Bryan Gurney 3 participants 3 messages Jul 9, 2025 – Jul 10, 2025

Subsystems (2)

v8 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

PATCH v8 8/8 nvme-multipath: queue-depth support for marginal paths

From: John Meneghini <[email protected]>

Exclude marginal paths from queue-depth io policy. In the case where all paths are marginal and no optimized or non-optimized path is found, we fall back to __nvme_find_path which selects the best marginal path.

---
 drivers/nvme/host/multipath.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/nvme/host/multipath.c +6 -1
index 8d4e54bb4261..767583e8454b 100644
@@ -420,6 +420,9 @@ static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head)
 		if (nvme_path_is_disabled(ns))
 			continue;
 
+		if (nvme_ctrl_is_marginal(ns->ctrl))
+			continue;
+
 		depth = atomic_read(&ns->ctrl->nr_active);
 
 		switch (ns->ana_state) {
@@ -443,7 +446,9 @@ static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head)
 			return best_opt;
 	}
 
-	return best_opt ? best_opt : best_nonopt;
+	best_opt = (best_opt) ? best_opt : best_nonopt;
+
+	return best_opt ? best_opt : __nvme_find_path(head, numa_node_id());
 }
 
 static inline bool nvme_path_is_optimized(struct nvme_ns *ns)
Signature · 1 line
2.50.0
#1 lore raw

Hannes, this patch fixes the queue-depth scheduler. Please take a look.

Quoted 37 lines · Bryan Gurney

From: John Meneghini <[email protected]>

Exclude marginal paths from queue-depth io policy. In the case where all paths are marginal and no optimized or non-optimized path is found, we fall back to __nvme_find_path which selects the best marginal path.

---
  drivers/nvme/host/multipath.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/nvme/host/multipath.c +6 -1
index 8d4e54bb4261..767583e8454b 100644
@@ -420,6 +420,9 @@ static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head)
  		if (nvme_path_is_disabled(ns))
  			continue;
 
+		if (nvme_ctrl_is_marginal(ns->ctrl))
+			continue;
+
  		depth = atomic_read(&ns->ctrl->nr_active);
 
  		switch (ns->ana_state) {
@@ -443,7 +446,9 @@ static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head)
  			return best_opt;
  	}
 
-	return best_opt ? best_opt : best_nonopt;
+	best_opt = (best_opt) ? best_opt : best_nonopt;
+
+	return best_opt ? best_opt : __nvme_find_path(head, numa_node_id());
  }
 
  static inline bool nvme_path_is_optimized(struct nvme_ns *ns)
#2 lore raw
Quoted 30 lines · John Meneghini

Hannes, this patch fixes the queue-depth scheduler.  Please take a look.

Quoted 27 lines · Bryan Gurney

From: John Meneghini <[email protected]>

Exclude marginal paths from queue-depth io policy. In the case where all paths are marginal and no optimized or non-optimized path is found, we fall back to __nvme_find_path which selects the best marginal path.

---
  drivers/nvme/host/multipath.c | 7 ++++++-

  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/nvme/host/multipath.c +3 -0
index 8d4e54bb4261..767583e8454b 100644
@@ -420,6 +420,9 @@ static struct nvme_ns 
 *nvme_queue_depth_path(struct nvme_ns_head *head)
           if (nvme_path_is_disabled(ns))
               continue;
+        if (nvme_ctrl_is_marginal(ns->ctrl))
+            continue;
+
           depth = atomic_read(&ns->ctrl->nr_active);
           switch (ns->ana_state) {
@@ -443,7 +446,9 @@ static struct nvme_ns 
 *nvme_queue_depth_path(struct nvme_ns_head *head)
Quoted 9 lines

drivers/nvme/host/multipath.c static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head) · line 454

Quoted 8 lines
drivers/nvme/host/multipath.c +3 -1
               return best_opt;
       }
-    return best_opt ? best_opt : best_nonopt;
+    best_opt = (best_opt) ? best_opt : best_nonopt;
+
+    return best_opt ? best_opt : __nvme_find_path(head, numa_node_id());
   }
   static inline bool nvme_path_is_optimized(struct nvme_ns *ns)

Hmm. Not convinced. I would expect a 'marginal' path to behave different (performance-wise) than unaffected paths. And the queue-depth scheduler should be able to handle paths with different performance characteristics just fine.
(Is is possible that your results are test artifacts? I guess your tool just injects FPIN messages with no performance impact, resulting in this behaviour...)

But if you want to exclude marginal paths from queue depth:
by all means, go for it.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke                  Kernel Storage Architect
[email protected]                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich