From: Nilay Shroff <nilay@linux.ibm.com>
To: linux-nvme@lists.infradead.org
Cc: kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, gjoyce@ibm.com,
axboe@fb.com, Nilay Shroff <nilay@linux.ibm.com>
Subject: [PATCH 1/1] nvme-tcp: Set correct numa-node id for host controller
Date: Thu, 13 Jun 2024 19:16:14 +0530 [thread overview]
Message-ID: <20240613134626.2252963-1-nilay@linux.ibm.com> (raw)
In the current implementation we always set numa-node id of the nvme
tcp host controller to NUMA_NO_NODE(-1). So on a multi-node numa
aware system when the iopolicy is set to NUMA, NVMe multipath code
can't calculate the accurate node distance and hence it can't select
the optimal path for IO.
This patch ensures that we set the correct numa-node id for the tcp host
controller and thus it would help ensure that for multipath scenario
the optimal path is selected for performing IO operations when iopolicy
is set to NUMA.
Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
---
drivers/nvme/host/tcp.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 8b5e4327fe83..d96a9b0c7c1a 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1924,6 +1924,10 @@ static int nvme_tcp_alloc_admin_queue(struct nvme_ctrl *ctrl)
{
int ret;
key_serial_t pskid = 0;
+ struct nvme_tcp_queue *queue;
+ struct sock *sk;
+ struct dst_entry *dst;
+ struct nvme_tcp_ctrl *tctrl = to_tcp_ctrl(ctrl);
if (nvme_tcp_tls(ctrl)) {
if (ctrl->opts->tls_key)
@@ -1942,10 +1946,21 @@ static int nvme_tcp_alloc_admin_queue(struct nvme_ctrl *ctrl)
if (ret)
return ret;
- ret = nvme_tcp_alloc_async_req(to_tcp_ctrl(ctrl));
+ ret = nvme_tcp_alloc_async_req(tctrl);
if (ret)
goto out_free_queue;
+ /* socket is already connected */
+ queue = &tctrl->queues[0];
+ sk = queue->sock->sk;
+ dst = sk_dst_get(sk);
+ if (likely(dst)) {
+ struct net_device *netdev;
+
+ netdev = netdev_sk_get_lowest_dev(dst->dev, sk);
+ ctrl->numa_node = dev_to_node(&netdev->dev);
+ dst_release(dst);
+ }
return 0;
out_free_queue:
--
2.45.1
reply other threads:[~2024-06-13 13:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240613134626.2252963-1-nilay@linux.ibm.com \
--to=nilay@linux.ibm.com \
--cc=axboe@fb.com \
--cc=gjoyce@ibm.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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;
as well as URLs for NNTP newsgroup(s).