Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754778AbcCYVgi (ORCPT ); Fri, 25 Mar 2016 17:36:38 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:23338 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754724AbcCYVgg (ORCPT ); Fri, 25 Mar 2016 17:36:36 -0400 From: Shaohua Li To: , CC: , , Subject: [PATCH 3/3] nvme: allocate nvme_queue in correct node Date: Fri, 25 Mar 2016 14:36:32 -0700 Message-ID: <598fda19022f1d25af0580f8a2e17825cf3a6431.1458941500.git.shli@fb.com> X-Mailer: git-send-email 2.8.0.rc2 In-Reply-To: <68fed570910230ce847f8f3b685eeea399640a7f.1458941500.git.shli@fb.com> References: <68fed570910230ce847f8f3b685eeea399640a7f.1458941500.git.shli@fb.com> X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-03-25_06:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1615 Lines: 54 nvme_queue is per-cpu queue (mostly). Allocating it in node where blk-mq will use it. Signed-off-by: Shaohua Li --- 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