mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shaohua Li <shli@fb.com>
To: <linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <axboe@fb.com>, <hch@infradead.org>, <Kernel-team@fb.com>
Subject: [PATCH 3/3] nvme: allocate nvme_queue in correct node
Date: Fri, 25 Mar 2016 14:36:32 -0700	[thread overview]
Message-ID: <598fda19022f1d25af0580f8a2e17825cf3a6431.1458941500.git.shli@fb.com> (raw)
In-Reply-To: <68fed570910230ce847f8f3b685eeea399640a7f.1458941500.git.shli@fb.com>

nvme_queue is per-cpu queue (mostly). Allocating it in node where blk-mq
will use it.

Signed-off-by: Shaohua Li <shli@fb.com>
---
 drivers/nvme/host/pci.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index f8db70a..8d24701 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1138,9 +1138,9 @@ static int nvme_alloc_sq_cmds(struct nvme_dev *dev, struct nvme_queue *nvmeq,
 }
 
 static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid,
-							int depth)
+							int depth, int node)
 {
-	struct nvme_queue *nvmeq = kzalloc(sizeof(*nvmeq), GFP_KERNEL);
+	struct nvme_queue *nvmeq = kzalloc_node(sizeof(*nvmeq), GFP_KERNEL, node);
 	if (!nvmeq)
 		return NULL;
 
@@ -1318,7 +1318,8 @@ static int nvme_configure_admin_queue(struct nvme_dev *dev)
 
 	nvmeq = dev->queues[0];
 	if (!nvmeq) {
-		nvmeq = nvme_alloc_queue(dev, 0, NVME_AQ_DEPTH);
+		nvmeq = nvme_alloc_queue(dev, 0, NVME_AQ_DEPTH,
+			dev_to_node(dev->dev));
 		if (!nvmeq)
 			return -ENOMEM;
 	}
@@ -1372,11 +1373,15 @@ static void nvme_watchdog_timer(unsigned long data)
 
 static int nvme_create_io_queues(struct nvme_dev *dev)
 {
-	unsigned i, max;
+	unsigned i, max, start;
 	int ret = 0;
+	int node;
 
+	start = dev->queue_count;
 	for (i = dev->queue_count; i <= dev->max_qid; i++) {
-		if (!nvme_alloc_queue(dev, i, dev->q_depth)) {
+		node = blk_mq_estimate_hw_queue_node(
+			dev->max_qid - start + 1, i - start);
+		if (!nvme_alloc_queue(dev, i, dev->q_depth, node)) {
 			ret = -ENOMEM;
 			break;
 		}
-- 
2.8.0.rc2

  parent reply	other threads:[~2016-03-25 21:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-25 21:36 [PATCH 1/3] blk-mq: add an API to estimate hardware queue node Shaohua Li
2016-03-25 21:36 ` [PATCH 2/3] blk-mq: allocate blk_mq_tags and requests in correct node Shaohua Li
2016-03-25 21:36 ` Shaohua Li [this message]
2016-03-29  7:24 ` [PATCH 1/3] blk-mq: add an API to estimate hardware queue node Christoph Hellwig
2016-03-29 16:47   ` Shaohua Li
2016-03-29 16:50     ` Jens Axboe
2016-03-29 17:44       ` Christoph Hellwig
2016-03-29 20:51         ` Jens Axboe
2016-03-29 21:20           ` Christoph Hellwig
2016-03-29 21:22             ` Jens Axboe

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=598fda19022f1d25af0580f8a2e17825cf3a6431.1458941500.git.shli@fb.com \
    --to=shli@fb.com \
    --cc=Kernel-team@fb.com \
    --cc=axboe@fb.com \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®