From patchwork Fri Mar 25 21:36:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaohua Li X-Patchwork-Id: 8673291 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1AB379F326 for ; Fri, 25 Mar 2016 21:37:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3A3FD2024F for ; Fri, 25 Mar 2016 21:37:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5493620222 for ; Fri, 25 Mar 2016 21:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754597AbcCYVgz (ORCPT ); Fri, 25 Mar 2016 17:36:55 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:27395 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754702AbcCYVgf (ORCPT ); Fri, 25 Mar 2016 17:36:35 -0400 Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.11/8.16.0.11) with SMTP id u2PLXtbU020642 for ; Fri, 25 Mar 2016 14:36:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=KxLG8CurUaCYpjPM61uujOUUvKT227h7hc+E1gGwc+0=; b=jt1cFfuLBjLVGQ1hkuO4yTMIU4r0oxdsjej1xWpJI7tIh2n+zfSihkXE5F5TSNy5x4BU /Ukv3O8bH3NfWJ1/MtZfuv4ddzgQ0TChH02Iqd4BRSKWWhJx+/MLnWYt+wpx9yo9RRPF QO7FIMsjYn2tvsgDiwa7me98/ShAdvS63Yk= Received: from mail.thefacebook.com ([199.201.64.23]) by m0001303.ppops.net with ESMTP id 21wd0dr3k0-1 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NOT) for ; Fri, 25 Mar 2016 14:36:34 -0700 Received: from mx-out.facebook.com (192.168.52.123) by PRN-CHUB05.TheFacebook.com (192.168.16.15) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 25 Mar 2016 14:36:33 -0700 Received: from facebook.com (2401:db00:11:d0a2:face:0:39:0) by mx-out.facebook.com (10.212.236.89) with ESMTP id a4bac4e4f2d111e5abb20002c95209d8-4b9ef3f0 for ; Fri, 25 Mar 2016 14:36:33 -0700 Received: by devbig084.prn1.facebook.com (Postfix, from userid 11222) id 7801947C3415; Fri, 25 Mar 2016 14:36:32 -0700 (PDT) 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 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-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }