Skip to contentSkip to conversation

nvme-fc: set numa_node after nvme_init_ctrl

PATCH In review Keith Busch 6 participants 6 messages Dec 19, 2023 – Dec 21, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-fc: set numa_node after nvme_init_ctrl

From: Keith Busch <[email protected]>

nvme_init_ctrl() always sets ctrl->numa_node to NUMA_NO_NODE. Set the desired value after that function call so it won't be overwritten.

---
 drivers/nvme/host/fc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/nvme/host/fc.c +5 -4
index 9f9a3b35dc64d..2de506d58593b 100644
@@ -3509,10 +3509,6 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
 
 	ctrl->ctrl.opts = opts;
 	ctrl->ctrl.nr_reconnects = 0;
-	if (lport->dev)
-		ctrl->ctrl.numa_node = dev_to_node(lport->dev);
-	else
-		ctrl->ctrl.numa_node = NUMA_NO_NODE;
 	INIT_LIST_HEAD(&ctrl->ctrl_list);
 	ctrl->lport = lport;
 	ctrl->rport = rport;
@@ -3558,6 +3554,11 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
 	if (ret)
 		goto out_free_queues;
 
+	if (lport->dev)
+		ctrl->ctrl.numa_node = dev_to_node(lport->dev);
+	else
+		ctrl->ctrl.numa_node = NUMA_NO_NODE;
+
 	/* at this point, teardown path changes to ref counting on nvme ctrl */
 
 	ret = nvme_alloc_admin_tag_set(&ctrl->ctrl, &ctrl->admin_tag_set,
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#4 lore raw
In reply to Keith Busch

Hi Keith,

Quoted 26 lines · Keith Busch

From: Keith Busch <[email protected]>

nvme_init_ctrl() always sets ctrl->numa_node to NUMA_NO_NODE. Set the desired value after that function call so it won't be overwritten.

---
  drivers/nvme/host/fc.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
drivers/nvme/host/fc.c +0 -4
index 9f9a3b35dc64d..2de506d58593b 100644
@@ -3509,10 +3509,6 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
 
  	ctrl->ctrl.opts = opts;
  	ctrl->ctrl.nr_reconnects = 0;
-	if (lport->dev)
-		ctrl->ctrl.numa_node = dev_to_node(lport->dev);
-	else
-		ctrl->ctrl.numa_node = NUMA_NO_NODE;
  	INIT_LIST_HEAD(&ctrl->ctrl_list);
  	ctrl->lport = lport;
  	ctrl->rport = rport;

drivers/nvme/host/fc.c nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, · line 3560

Quoted 7 lines
drivers/nvme/host/fc.c +4 -0
@@ -3558,6 +3554,11 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
  	if (ret)
  		goto out_free_queues;
 
+	if (lport->dev)
+		ctrl->ctrl.numa_node = dev_to_node(lport->dev);
+	else
+		ctrl->ctrl.numa_node = NUMA_NO_NODE;

We don't need the "else" clause, it is initialized to NUMA_NO_NODE.

Otherwise,

Quoted 4 lines
drivers/nvme/host/fc.c +1 -0
+
  	/* at this point, teardown path changes to ref counting on nvme ctrl */
 
  	ret = nvme_alloc_admin_tag_set(&ctrl->ctrl, &ctrl->admin_tag_set,
maintainer
#5 lore raw
Quoted 7 lines · Max Gurtovoy

drivers/nvme/host/fc.c nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, · line 3560

Quoted 4 lines · Keith Busch
drivers/nvme/host/fc.c +4 -0
+	if (lport->dev)
+		ctrl->ctrl.numa_node = dev_to_node(lport->dev);
+	else
+		ctrl->ctrl.numa_node = NUMA_NO_NODE;

We don't need the "else" clause, it is initialized to NUMA_NO_NODE.

This was just moving the existing hunk, but your suggestion is a nice bonus cleanup. I've folded it in and applied for nvme-6.8. Thanks!