Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4647898imm; Tue, 11 Sep 2018 15:35:27 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb5pLW5p4udE1bguysIZsf+Viq0Tmq6Z2axQXbvfrTfHmDPi9gnU+2i+WOYXIqYaWoVYI9G X-Received: by 2002:a17:902:654b:: with SMTP id d11-v6mr29543388pln.8.1536705327614; Tue, 11 Sep 2018 15:35:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536705327; cv=none; d=google.com; s=arc-20160816; b=KwlVQ9Cnu12KTe0x8XHlptKRTGdRCzZON0toVMwEhMs/FiAC4o5RdmYbuZHKJ2F28f EXMrsXGNRoTMbo5/r6rzS7h7WpGxa209ZqybvcoQQ/viwvIinN5+JimYzvnrZ/RHCkgG s6N0WyhMhv+gnwS16WY+7Vi2bf3Dl1Ras65SHHtGVHxa01x9cXVw7UdGZ8jzF7cH4JZQ g0cpUA/EVyYlrVQj2MeUDf7RUekpbclkKjcIGXYlZyKgDgZhxo9HgdkcSn+5RZQBKI+B /bRsIEO5X0Gm9kBuS7qIVZeSSapfaifUF8WKB6/nExSTCudL0Gr07XmEnQJ7W4deA3R6 vTsQ== 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 :references:in-reply-to:mime-version:dkim-signature; bh=kv3XhMMmx7rFVxnOKJEZ8pDEIg1ExIxoLsHSho0w5mk=; b=VsDMS2N1RiULvaaaTv+0h/VugB2bs/Y0ix5NEkkbD4TtmWMhCxujJlfBAy7WmOkL1o ULUMXCS4TOYi3PqJ8dX3b5vL2K5rMrWp+qpbANeuTfxQFL0xmh6bPD3aD4PV8iTIkuSj T1C6MdlsazSUDtCXaqrrZFN+3AQp2KMMsGwx2gbnrfOfctKvxpZSPt+xgEI3laKlZCJ7 3jlnZncnc84XDYXAxlVve8HLeMrwZjKZBvzX9nXJj5noOfrgAHFPuFNAtrHMmE0obdxV 7jDNsKLmaitM4dhPj7D8hsqD6VNLJgVTRBQd/tI4BzwS2iTKChsifwt9kBhZPtRZmGuw occQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=RA7naYm8; 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 144-v6si21700077pfw.95.2018.09.11.15.35.10; Tue, 11 Sep 2018 15:35:27 -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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=RA7naYm8; 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 S1727417AbeILDgc (ORCPT + 99 others); Tue, 11 Sep 2018 23:36:32 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:42706 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727047AbeILDgb (ORCPT ); Tue, 11 Sep 2018 23:36:31 -0400 Received: by mail-oi0-f65.google.com with SMTP id v198-v6so32735162oif.9 for ; Tue, 11 Sep 2018 15:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=kv3XhMMmx7rFVxnOKJEZ8pDEIg1ExIxoLsHSho0w5mk=; b=RA7naYm8BAzyDE+u5GEw46OtrvTW4luklLqwyUJpv6/S6+rcy4LQkPgyvh71tyXoQX QoPXtablKOVeov9qvnvUILX5Fyz320xdTg0mc9wvy0qU037H73YEV/QHD9jrE+4G9Mtb 7RuBlsQLhHohDVe97pWMpPdrPr6t2zXsyTmh61Q7ZI9tfhX/RlJfgzUvQOMxnA/fmYYP 1X1PdpHn133WnDavT9PsMJdXj1hsMVp0k+zIjxrY+Nh/36ybrCOMRXAQbjOS07oF2SPz ZTh/m6SYK31kc1d2uo55DFNvxXpHuLDpjqL6TzF1YmT3ocvtC9WCfLMTflH7XQDi/rhS TXiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=kv3XhMMmx7rFVxnOKJEZ8pDEIg1ExIxoLsHSho0w5mk=; b=Jma4Kf+boEynSIK0CURozFTZGjbxeqr3mERx3qoBNwf1PRhktJ38w3spGZ9aETZMNI MGEJFP2X3/mMa2VT+lXzvbS7hLsU2MDcIw2tblf+QXV5hXA+pvFlR9YfTHhxuU1AykxE d0Vz2QWPEGhACxmqU+3+GYKY+b8HozW+jRW3To5mej08lAbWxctQFsdXQHiIWxQeRHPK Gz3/RqX3TwKpT2gLrw/6fSPy1z8HX/fQd2PTpDqYV7Fjz5an1OsHAuSAi/ZVl9h6Y7vx bGGIvrOZcc+gbVEu3ZDhtdOwPlAlScW7GQ6owH7zl6AnaRZCZxxQWJK90T47u2NOOyi6 P4Ag== X-Gm-Message-State: APzg51AmVDsrJ4Gt8WoDvqRkeBSL2SNmL4OnYb5O03koJDygkdgk4Pto vRDumhlCT2XbhA3owiDWXachy72d3pj2NVKJz2xWHB4QekA= X-Received: by 2002:aca:5905:: with SMTP id n5-v6mr32431005oib.232.1536705304781; Tue, 11 Sep 2018 15:35:04 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:8e85:0:0:0:0:0 with HTTP; Tue, 11 Sep 2018 15:35:04 -0700 (PDT) In-Reply-To: <20180910234354.4068.65260.stgit@localhost.localdomain> References: <20180910232615.4068.29155.stgit@localhost.localdomain> <20180910234354.4068.65260.stgit@localhost.localdomain> From: Dan Williams Date: Tue, 11 Sep 2018 15:35:04 -0700 Message-ID: Subject: Re: [PATCH 3/4] mm: Defer ZONE_DEVICE page initialization to the point where we init pgmap To: Alexander Duyck Cc: Linux MM , Linux Kernel Mailing List , linux-nvdimm , pavel.tatashin@microsoft.com, Michal Hocko , Dave Jiang , Ingo Molnar , Dave Hansen , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Andrew Morton , Logan Gunthorpe , "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 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.