From patchwork Thu Sep 20 22:29:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 10608815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E52215A6 for ; Thu, 20 Sep 2018 22:30:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 500162E002 for ; Thu, 20 Sep 2018 22:30:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 442182E00C; Thu, 20 Sep 2018 22:30:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4F732E002 for ; Thu, 20 Sep 2018 22:30:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D1B948E0007; Thu, 20 Sep 2018 18:30:18 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CA11D8E0001; Thu, 20 Sep 2018 18:30:18 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B440F8E0007; Thu, 20 Sep 2018 18:30:18 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by kanga.kvack.org (Postfix) with ESMTP id 704DD8E0001 for ; Thu, 20 Sep 2018 18:30:18 -0400 (EDT) Received: by mail-pl1-f200.google.com with SMTP id h1-v6so341711pld.21 for ; Thu, 20 Sep 2018 15:30:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:from :to:cc:date:message-id:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=GrqJH7t83fWCDPoPPhyEVm2eAu2FCN5vFCJtp0C7hwU=; b=Lc3P7NRH4mg+iDx22IrZK+eGI9PuIQ+YEELAk6c17EkgSr4Ww2Mo95SlVVAYQL47FG cs0qdXfLc1iavoh3C6EC99TWRI1fWuwWw6Iw7pwLtwqfCDmoIwsBJ3/ty9f8D8UU6c54 R5S8GPFmDa7K1k3cf5e6tHCBID9saGL73cChldIc5h2fTTmMfweclehRNEyi3Ag/fBZN 9hl69t9JJrk/9lPXz8WCzSi+FQRdCZvmyv5RuzNu87Xsx5WQCjX6ZAsbvq+FX0r+xB99 XwfzNyZEkaCnkEb/+c9dJXCSt9kCwyloxl/llQgmUlC7eaSqbuJMNx/CROkCkFzWVOkN oAUw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of alexander.h.duyck@linux.intel.com designates 134.134.136.100 as permitted sender) smtp.mailfrom=alexander.h.duyck@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: APzg51Bz/V8H4KYqt/i5dRIJ20Qh4fQZeS54db7rro6P6a0VmCImkrCP j0EC3+w4qmMw/tcMVExy+gMi9Nu78ubu0D69NYtfpUZihdCei86RH45kfb4wshGqqZutBYrIJU7 Et9jPhHnFhvhXj4ZYldTD8RuPr886p9UG56WLi4QdRN3NyEwxLSvhgr/7MkEXte8yMQ== X-Received: by 2002:a63:1a5a:: with SMTP id a26-v6mr38994085pgm.9.1537482618115; Thu, 20 Sep 2018 15:30:18 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbOT8BqwgzI3ZJtDgo/scmz8mpIskeRQDRPOFo2bZe7ECJOwTQ2dRZ1LK8rpxWzVByyES4f X-Received: by 2002:a63:1a5a:: with SMTP id a26-v6mr38994037pgm.9.1537482617255; Thu, 20 Sep 2018 15:30:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537482617; cv=none; d=google.com; s=arc-20160816; b=nwTjDXkInPmh4qJoqXPoWxjdtaamr+BMa9XNKGW7budcfs35q4TFRjGZhHKaWGngeM Yhv9AQTR4ij6Vo1A1fFIbTdYKyHMzo9EligkwI/U2jgarNRiQAZol7uXqi/K3RCHVVa1 k0CE7QoBoMUOjJiR5gQnZV1WB4vKd5RJPfxg7srHuGoKOGlmzo0C1a9nM3m3R0xc95fh 2dFRt2NQHy66rWs3azvDsgN75MPKanFb5iZ9Ilin1yXDu/X0dbEksMK1BBy8mFL3w1LR q1p1V7feskPkRvUrdzfZLXIk1U1zRI4XqYKbMM+eM/vJlKcYhLN9sdylN1RMHDEjcLiZ HKwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject; bh=GrqJH7t83fWCDPoPPhyEVm2eAu2FCN5vFCJtp0C7hwU=; b=VaVyIOIiGn9HgiHlTQhGHRK8IVlKVuA2h34SDh5NgCSsw6PJ6x409PDp55MB8miYkr nga1jRZDecSxWqHq87wPE3x3b0zLVXITcgg2c9IyWZxojWsOr4+aubFk5GsIjatyAxnO WSo7QP//xEqDWF4i94otK6sVtUC4Vltpqe22HFMri/57EffynIUda69fMRU56TyvzgoE 3k0alswApaROdiSM2a3vx+6FFbfZ98dVRAxVLA62Yl+NfeKnrLJEvY081QP0Gr+8uing HcX3IIZcXetkKD5faI6LWNpXNaZYC9HLIXpOjV7TeP0a439/BRcDoGPm1xtMkyK+UThB d+6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of alexander.h.duyck@linux.intel.com designates 134.134.136.100 as permitted sender) smtp.mailfrom=alexander.h.duyck@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga07.intel.com (mga07.intel.com. [134.134.136.100]) by mx.google.com with ESMTPS id k8-v6si3030247plt.176.2018.09.20.15.30.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Sep 2018 15:30:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of alexander.h.duyck@linux.intel.com designates 134.134.136.100 as permitted sender) client-ip=134.134.136.100; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of alexander.h.duyck@linux.intel.com designates 134.134.136.100 as permitted sender) smtp.mailfrom=alexander.h.duyck@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Sep 2018 15:30:16 -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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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)