* [PATCH RFC] nvme-multipath: optimize path selection in queue-depth policy
@ 2026-05-06 14:15 Xose Vazquez Perez
0 siblings, 0 replies; only message in thread
From: Xose Vazquez Perez @ 2026-05-06 14:15 UTC (permalink / raw)
Cc: Xose Vazquez Perez, Aviv Coro, Bart Van Assche,
Benjamin Marzinski, Brian Bunker, Caleb Sander,
Chaitanya Kulkarni, Chris Leech, Christophe Varoqui,
Christoph Hellwig, Clayton Skaggs, Constantine Gavrilov,
Daniel Wagner, David Santamaría Rogado, Dmitry V. Levin,
Ewan D. Milne, Hannes Reinecke, James Smart, Jens Axboe,
John Meneghini, Jyoti Rani, Keith Busch, Li Xiaokeng,
Marco Patalano, Martin Belanger, Martin George, Martin Wilck,
Matthias Rudolph, Maurizio Lombardi, NetApp RDAC team,
Nilay Shroff, Randy Jennings, Sagi Grimberg, Simon Schricker,
Steven Schremmer, Thomas Song, Uday Shankar, Vasuki Manikarnike,
Wayne Berthiaume, Zou Ming, BLOCK-ML, DM_DEVEL-ML, NVME-ML,
SCSI-ML
Move the zero-depth check inside the optimized path case to enable early
exit. It avoids redundant condition checks for non-optimized paths, and
eliminates the per-iteration check at the end of the loop, improving the
performance.
Cc: Aviv Coro <aviv.coro@ibm.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Brian Bunker <brian@purestorage.com>
Cc: Caleb Sander <csander@purestorage.com>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Cc: Chris Leech <cleech@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Clayton Skaggs <claytons@netapp.com>
Cc: Constantine Gavrilov <cgavrilov@infinidat.com>
Cc: Daniel Wagner <wagi@kernel.org>
Cc: David Santamaría Rogado <howl.nsp@gmail.com>
Cc: Dmitry V. Levin <ldv@strace.io>
Cc: Ewan D. Milne <emilne@redhat.com>
Cc: Ewan Milne <emilne@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: James Smart <jsmart2021@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: John Meneghini <jmeneghi@redhat.com>
Cc: Jyoti Rani <jrani@purestorage.com>
Cc: Keith Busch <kbusch@kernel.org>
Cc: Li Xiaokeng <lixiaokeng@huawei.com>
Cc: Marco Patalano <mpatalan@redhat.com>
Cc: Martin Belanger <martin.belanger@dell.com>
Cc: Martin George <Martin.George@netapp.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Matthias Rudolph <Matthias.Rudolph@hitachivantara.com>
Cc: Maurizio Lombardi <mlombard@arkamax.eu>
Cc: NetApp RDAC team <ng-eseries-upstream-maintainers@netapp.com>
Cc: Nilay Shroff <nilay@linux.ibm.com>
Cc: Randy Jennings <randyj@purestorage.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Simon Schricker <sschricker@suse.de>
Cc: Steven Schremmer <Steve.Schremmer@netapp.com>
Cc: Thomas Song <tsong@purestorage.com>
Cc: Uday Shankar <ushankar@purestorage.com>
Cc: Vasuki Manikarnike <vasuki.manikarnike@hpe.com>
Cc: Wayne Berthiaume <Wayne.Berthiaume@dell.com>
Cc: Zou Ming <zouming.zouming@huawei.com>
Cc: BLOCK-ML <linux-block@vger.kernel.org>
Cc: DM_DEVEL-ML <dm-devel@lists.linux.dev>
Cc: NVME-ML <linux-nvme@lists.infradead.org>
Cc: SCSI-ML <linux-scsi@vger.kernel.org>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
---
Status: Compile-tested only. UNTESTED on real hardware.
[I do not have access to this kind of hardware]
Feedback and testing are highly welcome.
---
drivers/nvme/host/multipath.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 263161cb8ac0..7d212f6e865d 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -409,6 +409,8 @@ static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head)
min_depth_opt = depth;
best_opt = ns;
}
+ if (min_depth_opt == 0)
+ goto out;
break;
case NVME_ANA_NONOPTIMIZED:
if (depth < min_depth_nonopt) {
@@ -419,11 +421,8 @@ static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head)
default:
break;
}
-
- if (min_depth_opt == 0)
- return best_opt;
}
-
+out:
return best_opt ? best_opt : best_nonopt;
}
--
2.54.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-06 14:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-06 14:15 [PATCH RFC] nvme-multipath: optimize path selection in queue-depth policy Xose Vazquez Perez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox