Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4764742imm; Tue, 11 Sep 2018 17:51:46 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda0nWQAN/gxK9jXffVD6nprweIhAGtGLLRXhHvvTjFoxYoFAGFwuCXlxH0ju4LEyoQu3VBp X-Received: by 2002:a63:ea49:: with SMTP id l9-v6mr30926400pgk.427.1536713506504; Tue, 11 Sep 2018 17:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536713506; cv=none; d=google.com; s=arc-20160816; b=XV8bfv7F9ydlnw45w89jq6sgJ/ZVEuun4ot1RVjDrsfhMYTX44sUSgLJE3JTyDEsHQ ESPku2ZXTyv8pgI2iNmaGute+slwY3kkh7cNneX8+oBWHewPmUWmIp7378/NktwP1A3b lblxDJR6ahgO3F+079Mr1mPfpTVkQ8t8lPEJWNNZSl2b21aazEPzpKvPC6zkVppWr/e/ hMZ0dcK+0GOk9poBd+JjkEHc8G4Qb+yl/xO55brjJuRrEm308Ok1XnpNyehKIfQWwDMH GQB/JJ3sOzZ6R5DXZd8ciYGMXPPe60tevxsMDIZkwHYNCW88/LnYWwPuHZSCm6KwK6kx a+Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=2Bp5lpcwY2KV1TK1laCJynoM0S298G59R+JbaKrUErY=; b=tG49j77likWu38PMBRrstuVr2t6w2aDIOJrcuK+5Ctk6aw+1uCJm3tPM0b2+354xxE Mr1UJ6rId6/4ee59YftT1f3mbQEWONoLy4wCw5LEL2mS5KAy9DA+F2Li5fmZt/O2z1FH bAoMmtjqay33Nn5cX93DWwy8qbmL0ykC9C8Fk25cr9QreRlzTvq4ROHmrNvrrQtKS/Oy ZCMhTeQrgAFOl9yd6T6abTK7ndX00CaCHsf2RzMp5UOKLEgPQOh1Flp6QwRBXw/LsHYg G2TE3ndXn7ck1tF8zaRKfU8D2IuVHP7Fg/RoSyNCIvlo/85WPv/U7u4LnsRnznZlK74a 9bQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hJwQGZzo; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n14-v6si23244358pgm.11.2018.09.11.17.51.30; Tue, 11 Sep 2018 17:51:46 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hJwQGZzo; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727735AbeILFxM (ORCPT + 99 others); Wed, 12 Sep 2018 01:53:12 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:50186 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726092AbeILFxM (ORCPT ); Wed, 12 Sep 2018 01:53:12 -0400 Received: by mail-it0-f66.google.com with SMTP id j81-v6so803931ite.0 for ; Tue, 11 Sep 2018 17:51:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2Bp5lpcwY2KV1TK1laCJynoM0S298G59R+JbaKrUErY=; b=hJwQGZzoMI1pZFeshvtiz1oOB4Me+JkiYnAeIkf4ShEh/6i5LwOb1JD1TiNEqCJtDv cWVejsKyMCL77ObnORGBzG7Vtf3+WPWpEsIigNxQIwYe/2wUUgbNgFiPTLDQ87QEfxSl BqLX9zXUFcnzsByrfRydWBNg37az+YFyCGpHJgBzXbvlGh+KDGim0apyDBtTHzVk8AqG FBAmWrynAm0VMYlOmwPIT/5DZlqNNWg6TLz5aRx1Cb0N28OI0j/LKPnd4HAOXfByIYqF wpu66WdoePaUX1aEGgFBzsAdx/DpIsBLpczRVkS/LOBJyv8e4YhTMG3B7LomM3znBPFF d04g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2Bp5lpcwY2KV1TK1laCJynoM0S298G59R+JbaKrUErY=; b=CeJhgXg/u/ngi5BAoonH5ksivHagkHbayMsEEZGJK64sunzWEnCoSTOL675aOitbKT UEu6dKW7ggzS/HeEV77kBqaecUT8SRhhUKAVnzgvpMel7LlelT6wNrgXm/DQRANB8vee U9yp6JBwOG750zAVmi+rYSlZM7ivE/2EA0il3u7kkFAYAKSQU9Obn9orIkP07zLAjFYi K7C7HguVc9LciwJV+0SLnvrrmIZA6iWp0QhO4Zhfw4IxKagYo7kKaUAgP64K7yWoiYfG 2xTjIQkzmfZayh+Zu5zJZp7XhGz9oT2HkO8S29Y+1xgeAsmxbv8qQrhgV2DxKZz3ok0b Aw1w== X-Gm-Message-State: APzg51CDl9hF/Vyg4otdAWMrJgn1fZ8ZYQUXRwJS+Q/TtGhkP0qSlyd1 7ZWkN4ol6o1aU+J/+jMLDWtAaa4W08yIYJqq5fSpsg== X-Received: by 2002:a24:ed84:: with SMTP id r126-v6mr4216409ith.58.1536713478893; Tue, 11 Sep 2018 17:51:18 -0700 (PDT) MIME-Version: 1.0 References: <20180910232615.4068.29155.stgit@localhost.localdomain> <20180910234354.4068.65260.stgit@localhost.localdomain> In-Reply-To: From: Alexander Duyck Date: Tue, 11 Sep 2018 17:51:07 -0700 Message-ID: Subject: Re: [PATCH 3/4] mm: Defer ZONE_DEVICE page initialization to the point where we init pgmap To: dan.j.williams@intel.com Cc: linux-mm , LKML , linux-nvdimm@lists.01.org, pavel.tatashin@microsoft.com, Michal Hocko , dave.jiang@intel.com, Ingo Molnar , Dave Hansen , jglisse@redhat.com, Andrew Morton , logang@deltatee.com, "Kirill A. Shutemov" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 11, 2018 at 3:35 PM Dan Williams wrote: > > On Mon, Sep 10, 2018 at 4:43 PM, Alexander Duyck > wrote: > > > > From: Alexander Duyck > > > > The ZONE_DEVICE pages were being initialized in two locations. One was with > > the memory_hotplug lock held and another was outside of that lock. The > > problem with this is that it was nearly doubling the memory initialization > > time. Instead of doing this twice, once while holding a global lock and > > once without, I am opting to defer the initialization to the one outside of > > the lock. This allows us to avoid serializing the overhead for memory init > > and we can instead focus on per-node init times. > > > > One issue I encountered is that devm_memremap_pages and > > hmm_devmmem_pages_create were initializing only the pgmap field the same > > way. One wasn't initializing hmm_data, and the other was initializing it to > > a poison value. Since this is something that is exposed to the driver in > > the case of hmm I am opting for a third option and just initializing > > hmm_data to 0 since this is going to be exposed to unknown third party > > drivers. > > > > Signed-off-by: Alexander Duyck > > --- > > include/linux/mm.h | 2 + > > kernel/memremap.c | 24 +++++--------- > > mm/hmm.c | 12 ++++--- > > mm/page_alloc.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++- > > Hmm, why mm/page_alloc.c and not kernel/memremap.c for this new > helper? I think that would address the kbuild reports and keeps all > the devm_memremap_pages / ZONE_DEVICE special casing centralized. I > also think it makes sense to move memremap.c to mm/ rather than > kernel/ especially since commit 5981690ddb8f "memremap: split > devm_memremap_pages() and memremap() infrastructure". Arguably, that > commit should have went ahead with the directory move. The issue ends up being the fact that I would then have to start exporting infrastructure such as __init_single_page from page_alloc. I have some follow-up patches I am working on that will generate some other shared functions that can be used by both memmap_init_zone and memmap_init_zone_device, as well as pulling in some of the code from the deferred memory init.