public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: "Ewan D. Milne" <emilne@redhat.com>
To: linux-nvme@lists.infradead.org
Cc: tsong@purestorage.com, jmeneghi@redhat.com, mlombard@redhat.com
Subject: [PATCH 3/3] nvme-multipath: add "use_nonoptimized" module option
Date: Mon, 25 Sep 2023 12:31:23 -0400	[thread overview]
Message-ID: <20230925163123.16042-4-emilne@redhat.com> (raw)
In-Reply-To: <20230925163123.16042-1-emilne@redhat.com>

Setting nvme_core.use_nonoptimized=true will cause the path
selector to treat optimized and nonoptimized paths equally.

This is because although an NVMe fabrics target device may report
an unoptimized ANA state, it is possible that other factors such
as fabric latency are a large factor in the I/O service time.  And,
throughput may improve overall if nonoptimized ports are also used.

Signed-off-by: Ewan D. Milne <emilne@redhat.com>
---
 drivers/nvme/host/multipath.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index deea7fd4aa95..f640b8ad934b 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -13,6 +13,10 @@ bool multipath = true;
 module_param(multipath, bool, 0444);
 MODULE_PARM_DESC(multipath,
 	"turn on native support for multiple controllers per subsystem");
+bool use_nonoptimized = false;
+module_param(use_nonoptimized, bool, 0644);
+MODULE_PARM_DESC(use_nonoptimized,
+	"Use ANA nonoptimized paths as well as optimized paths for I/O");
 
 static const char *nvme_iopolicy_names[] = {
 	[NVME_IOPOLICY_NUMA]	= "numa",
@@ -272,7 +276,10 @@ static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int node)
 		}
 	}
 
-	if (!found)
+	/*
+	 * If fallback_distance was set, fallback must also be set
+	 */
+	if (!found || (use_nonoptimized && (fallback_distance < found_distance)))
 		found = fallback;
 	if (found)
 		rcu_assign_pointer(head->current_path[node], found);
@@ -310,8 +317,12 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
 			found = ns;
 			goto out;
 		}
-		if (ns->ana_state == NVME_ANA_NONOPTIMIZED)
+		if (ns->ana_state == NVME_ANA_NONOPTIMIZED) {
 			found = ns;
+			if (use_nonoptimized)
+				goto out;
+		}
+
 	}
 
 	/*
@@ -321,7 +332,7 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
 	 *  - no other usable path found and current is usable.
 	 */
 	if (!nvme_path_is_disabled(old) &&
-	    (old->ana_state == NVME_ANA_OPTIMIZED ||
+	    (old->ana_state == NVME_ANA_OPTIMIZED || use_nonoptimized ||
 	     (!found && old->ana_state == NVME_ANA_NONOPTIMIZED)))
 		return old;
 
@@ -364,6 +375,11 @@ static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head,
 		}
 	}
 
+	/*
+	 * If min_depth_nonopt was set, best_nonopt must also be set
+	 */
+	if (use_nonoptimized && (min_depth_nonopt < min_depth_opt))
+		return best_nonopt;
 	return best_opt ? best_opt : best_nonopt;
 }
 
-- 
2.20.1



  parent reply	other threads:[~2023-09-25 16:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-25 16:31 [PATCH 0/3] NVMe multipath path selector enhancements Ewan D. Milne
2023-09-25 16:31 ` [PATCH 1/3] block: introduce blk_queue_nr_active() Ewan D. Milne
2023-09-25 20:56   ` Bart Van Assche
2023-09-27 14:49     ` Ewan Milne
2023-09-27 14:58       ` Bart Van Assche
2023-09-27  7:36   ` Hannes Reinecke
2023-09-27 11:37     ` Ming Lei
2023-09-27 13:34     ` Ewan Milne
2023-10-03 20:11       ` Uday Shankar
2023-10-04  9:19         ` Sagi Grimberg
2023-09-27  9:49   ` Ming Lei
2023-09-27 13:54     ` Ewan Milne
2023-09-27 10:56   ` Sagi Grimberg
2023-09-27 13:50     ` Ewan Milne
2023-09-28 10:56       ` Sagi Grimberg
2023-09-25 16:31 ` [PATCH 2/3] nvme-multipath: Implement new iopolicy "queue-depth" Ewan D. Milne
2023-09-27  7:38   ` Hannes Reinecke
2023-09-27 11:02     ` Sagi Grimberg
2023-09-27 13:42     ` Ewan Milne
2023-09-25 16:31 ` Ewan D. Milne [this message]
2023-09-27  7:41   ` [PATCH 3/3] nvme-multipath: add "use_nonoptimized" module option Hannes Reinecke
2023-09-27 11:31     ` Sagi Grimberg
2023-09-27 13:11       ` John Meneghini
2023-09-27 13:45     ` Ewan Milne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230925163123.16042-4-emilne@redhat.com \
    --to=emilne@redhat.com \
    --cc=jmeneghi@redhat.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mlombard@redhat.com \
    --cc=tsong@purestorage.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox