Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp77001imm; Thu, 20 Sep 2018 15:31:25 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaB0bc58MllvgGUcvotZ+q7pT2Lcr9NfOiRiBNPyLZxgI7jKDGfKvZLhxCIthw2L2vf6nSa X-Received: by 2002:a62:b20c:: with SMTP id x12-v6mr43012749pfe.201.1537482685820; Thu, 20 Sep 2018 15:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537482685; cv=none; d=google.com; s=arc-20160816; b=PC90Pci//I2UDULD58rKMJRLRN5/kUbg+eaHpSI+rN5cukYk9hCmUbEY172Zk9qLIJ 9nuUXIz9IL9zwzedX2e/k0M13XzGgKuCuLSoGrTcDRuGWDuxRvO+3Vo9O7GAfBOemRX6 qkKvVInDcPhMKbtjPwIHs4QgS7PWMqXw5gfPuL0VvMmGLeSHAYheiMBY5FU7e15gCzT0 GpLloziBW/ssIN2ruPZVBpLg4YJp4hQvQ0f7qK97NACq+q+s1ihpukyBCx6llYLs5fDd o90l/wFrq9dcasH+437/41IUc90f94nYttqr6ovKA1KaX6ZQ3Ab+BVmtmKLfwppEFAdA yqbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject; bh=GrqJH7t83fWCDPoPPhyEVm2eAu2FCN5vFCJtp0C7hwU=; b=KxI3TZlfm8u1oGlxxqP5yqQrqctg3je38tACLaGaRk/U0kJD3E+97e4YOOh7Jt6hRf 78+StVFWRhZSQpvDwoxAAJb3FrnuAYYYVcwW6BSNzk1ZQOcM7XOGRJPXyBLot2oUpj3L vIfgslNgvnG0BodMkdIxeyZ5MZ9BwS4DsVqUVmgEQaNn9/5Ob/rXHlyJVPWpOUc9pFOs O/uJYQhJs5y9l01cIVmeQrcKmD3CKq+OuMTz5/jrib3AkFjZqboHtVZGfUXDDJfqAAM3 PFNpySFBXR26nRklWhlqixbLeM4aXxE+NyWtw015CCwF3zjhzYpCcgD9PjAVaexYFJXM 095w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d40-v6si25766331pla.217.2018.09.20.15.31.09; Thu, 20 Sep 2018 15:31:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727643AbeIUEQB (ORCPT + 99 others); Fri, 21 Sep 2018 00:16:01 -0400 Received: from mga12.intel.com ([192.55.52.136]:21358 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725808AbeIUEQB (ORCPT ); Fri, 21 Sep 2018 00:16:01 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Sep 2018 15:30:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,282,1534834800"; d="scan'208";a="85287175" Received: from ahduyck-mobl.amr.corp.intel.com (HELO localhost.localdomain) ([10.7.198.152]) by orsmga003.jf.intel.com with ESMTP; 20 Sep 2018 15:29:58 -0700 Subject: [PATCH v4 5/5] nvdimm: Schedule device registration on node local to the device From: Alexander Duyck To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org Cc: pavel.tatashin@microsoft.com, mhocko@suse.com, dave.jiang@intel.com, mingo@kernel.org, dave.hansen@intel.com, jglisse@redhat.com, akpm@linux-foundation.org, logang@deltatee.com, dan.j.williams@intel.com, kirill.shutemov@linux.intel.com Date: Thu, 20 Sep 2018 15:29:57 -0700 Message-ID: <20180920222951.19464.39241.stgit@localhost.localdomain> In-Reply-To: <20180920215824.19464.8884.stgit@localhost.localdomain> References: <20180920215824.19464.8884.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch is meant to force the device registration for nvdimm devices to be closer to the actual device. This is achieved by using either the NUMA node ID of the region, or of the parent. By doing this we can have everything above the region based on the region, and everything below the region based on the nvdimm bus. One additional change I made is that we hold onto a reference to the parent while we are going through registration. By doing this we can guarantee we can complete the registration before we have the parent device removed. By guaranteeing NUMA locality I see an improvement of as high as 25% for per-node init of a system with 12TB of persistent memory. Signed-off-by: Alexander Duyck --- drivers/nvdimm/bus.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index 8aae6dcc839f..ca935296d55e 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -487,7 +487,9 @@ static void nd_async_device_register(void *d, async_cookie_t cookie) dev_err(dev, "%s: failed\n", __func__); put_device(dev); } + put_device(dev); + put_device(dev->parent); } static void nd_async_device_unregister(void *d, async_cookie_t cookie) @@ -504,12 +506,25 @@ static void nd_async_device_unregister(void *d, async_cookie_t cookie) void __nd_device_register(struct device *dev) { + int node; + if (!dev) return; + dev->bus = &nvdimm_bus_type; + get_device(dev->parent); get_device(dev); - async_schedule_domain(nd_async_device_register, dev, - &nd_async_domain); + + /* + * For a region we can break away from the parent node, + * otherwise for all other devices we just inherit the node from + * the parent. + */ + node = is_nd_region(dev) ? to_nd_region(dev)->numa_node : + dev_to_node(dev->parent); + + async_schedule_on_domain(nd_async_device_register, dev, node, + &nd_async_domain); } void nd_device_register(struct device *dev)