Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2581915imm; Thu, 11 Oct 2018 12:36:35 -0700 (PDT) X-Google-Smtp-Source: ACcGV61LEADjXMX4bAM7q1JP2GkE8pBHhKrzJx63KwK6Q6Y+OpXuxcktEY8EX7l/qBGjefE+eM7c X-Received: by 2002:a62:c60a:: with SMTP id m10-v6mr2888995pfg.15.1539286595764; Thu, 11 Oct 2018 12:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539286595; cv=none; d=google.com; s=arc-20160816; b=Y7hQPgMizEOOAmPHySpljIBIBUY1N2GGu7N0yO9NmacXpqRQIC4S6IzDB2xQyq/iFl /pxLz/KsPycjKdhukEXQzn4l1p1UsKxdMxHjZp1qTgnet9v496KYwS04WWDmMlnvzcmM sbOOZ0abq2naWBpuZ6SDfhOvKVejMeM+KsRLERk/2n6P8Xi3swnHcI3LbSoXVzBXp03A SCIR/Hf8imGVddLGaBmjYiV2/ob4T8E4gXWdyZvIVBeYBprDPVh7dVkMPcQEen3n00sX j1OVDrd9q597sXZLg51+CSosH9UQai1sTooGO2k1689aHxuf7acACNKzqByKY45dGcp/ qH5Q== 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=4e4jLXe+LV66T9Mf2f7NGFsZVkeztaj86piUEVwbQ9s=; b=OHcQNxz3bPpca8xbDWzK7uSZAG0JESVNKPBU2xA7p3FaUGBc1ogL/CysWHZfvIMYGS 5bN7wqKb6TApbQJoaqFiwm2sSzluL6m0G4HGyBHq3wprYzO2KN5+Ou6yWt6XdsGQtZiL kLIq4RyGeW6R99UUhY59RDsq6cXxkFBhMyeV0pEzhzMAel1+uBn4xN2TDUV5ea9mnH6Y iEipKyLGbS6iImIyhd63U/jx/fiR3NXHtJbPo14N1lpSkDwTNi5SMaQvpecxbmlzmUxk XRQ9tRLvj8nc07obDY9u4gsm0FjDr4Q65Hp8RXQPrJw9vdo14dXfxrGQzNMklvg6Pe53 2GkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=RJ7fcdb6; 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 q15-v6si24400386pgg.477.2018.10.11.12.36.20; Thu, 11 Oct 2018 12:36:35 -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=RJ7fcdb6; 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 S1728963AbeJLBug (ORCPT + 99 others); Thu, 11 Oct 2018 21:50:36 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:39294 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728874AbeJLBug (ORCPT ); Thu, 11 Oct 2018 21:50:36 -0400 Received: by mail-ot1-f66.google.com with SMTP id l58so9882076otd.6 for ; Thu, 11 Oct 2018 11:22:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4e4jLXe+LV66T9Mf2f7NGFsZVkeztaj86piUEVwbQ9s=; b=RJ7fcdb6PB4rZ/tkhaU3tx4RjODQ2bUmy8ar2xwof3/iw+poe+qldL4CSCWHnbXesj h/Bh0LQt9qJZXqVq1JF86uGXLaEvPoL9wfOiPJRv2Cac6wOUH+kX6gIiOM2fwvvT/3k0 15zAyZUmeeMC2plNpgrm4Uk5xYxCHe2iMpfq75odVRJyVLqCt/6C3Ytprr8Ik8yGUbEz EdLDhm1FBxqZkK9P6BgaA+80jgzudUgrgePZbjnTIe0qD33MEAkFI0lvBfdh2T0tkpzU KKckFvRRGtMmnvOcJduCZxDFPeWoxTDbITC3tnai9QWtN78QsnYeZ0nXz+0y6BjE1yev sX2A== 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=4e4jLXe+LV66T9Mf2f7NGFsZVkeztaj86piUEVwbQ9s=; b=BYReKbGUsH0L52u6Q1gTegI4d/4xXEwoYdeVJn6aOgzke2gBAwrhL4ezcTyDNflR10 P/bBhZgrRgVZVj7Y4lNawn6I38p6VUNpuahoknr75Md778tpThmrsExD5wenfP6WR2FI ytmDQJtURmx7mbJgsM6xMxQfcIMVdj7aMvhVkLT/8QY9lW7Wsf+jSLlXh+/ifDYGBBQj 4ZrVxiSFPBlWST93ZjZHPpznyNG+n8aI87VcNPxWlUGw0dDZjXGej8lvw2u6boqA+wfH eGBFWqHaNuMmiLKlHpykSaOioK+oYOwSqFXSLJ/OKErgnSPV84BzjAWivREhPaTvv6CW ypSQ== X-Gm-Message-State: ABuFfojOHI1MCK68H+fYqkc03OtooxoJ8iPGlqAx12OGNZndjlBvmQq0 WkI6vXIdHmVvcF63mAg72HBNVLzuQruyhdMFXjNIZA== X-Received: by 2002:a9d:56ef:: with SMTP id b44mr1840945otj.214.1539282133430; Thu, 11 Oct 2018 11:22:13 -0700 (PDT) MIME-Version: 1.0 References: <20180925200551.3576.18755.stgit@localhost.localdomain> <20180925202053.3576.66039.stgit@localhost.localdomain> <20181009170051.GA40606@tiger-server> <25092df0-b7b4-d456-8409-9c004cb6e422@linux.intel.com> <20181010095838.GG5873@dhcp22.suse.cz> <20181010172451.GK5873@dhcp22.suse.cz> <98c35e19-13b9-0913-87d9-b3f1ab738b61@linux.intel.com> <20181010185242.GP5873@dhcp22.suse.cz> <20181011085509.GS5873@dhcp22.suse.cz> <6f32f23c-c21c-9d42-7dda-a1d18613cd3c@linux.intel.com> In-Reply-To: <6f32f23c-c21c-9d42-7dda-a1d18613cd3c@linux.intel.com> From: Dan Williams Date: Thu, 11 Oct 2018 11:22:02 -0700 Message-ID: Subject: Re: [PATCH v5 4/4] mm: Defer ZONE_DEVICE page initialization to the point where we init pgmap To: alexander.h.duyck@linux.intel.com Cc: Michal Hocko , Linux MM , Andrew Morton , Linux Kernel Mailing List , linux-nvdimm , Pasha Tatashin , Dave Hansen , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , rppt@linux.vnet.ibm.com, Ingo Molnar , "Kirill A. Shutemov" , Zhang Yi 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 Thu, Oct 11, 2018 at 10:39 AM Alexander Duyck wrote: > > On 10/11/2018 1:55 AM, Michal Hocko wrote: > > On Wed 10-10-18 20:52:42, Michal Hocko wrote: > > [...] > >> My recollection was that we do clear the reserved bit in > >> move_pfn_range_to_zone and we indeed do in __init_single_page. But then > >> we set the bit back right afterwards. This seems to be the case since > >> d0dc12e86b319 which reorganized the code. I have to study this some more > >> obviously. > > > > so my recollection was wrong and d0dc12e86b319 hasn't really changed > > much because __init_single_page wouldn't zero out the struct page for > > the hotplug contex. A comment in move_pfn_range_to_zone explains that we > > want the reserved bit because pfn walkers already do see the pfn range > > and the page is not fully associated with the zone until it is onlined. > > > > I am thinking that we might be overzealous here. With the full state > > initialized we shouldn't actually care. pfn_to_online_page should return > > NULL regardless of the reserved bit and normal pfn walkers shouldn't > > touch pages they do not recognize and a plain page with ref. count 1 > > doesn't tell much to anybody. So I _suspect_ that we can simply drop the > > reserved bit setting here. > > So this has me a bit hesitant to want to just drop the bit entirely. If > nothing else I think I may wan to make that a patch onto itself so that > if we aren't going to set it we just drop it there. That way if it does > cause issues we can bisect it to that patch and pinpoint the cause. > > > Regarding the post initialization required by devm_memremap_pages and > > potentially others. Can we update the altmap which is already a way how > > to get alternative struct pages by a constructor which we could call > > from memmap_init_zone and do the post initialization? This would reduce > > the additional loop in the caller while it would still fit the overall > > design of the altmap and the core hotplug doesn't have to know anything > > about DAX or whatever needs a special treatment. > > > > Does that make any sense? > > I think the only thing that is currently using the altmap is the > ZONE_DEVICE memory init. Specifically I think it is only really used by > the devm_memremap_pages version of things, and then only under certain > circumstances. Also the HMM driver doesn't pass an altmap. What we would > really need is a non-ZONE_DEVICE users of the altmap to really justify > sticking with that as the preferred argument to pass. Right, the altmap is optional. It's only there to direct the memmap array to be allocated from the memory-range being hot-added vs a dynamic page-allocator allocation from System-RAM. > For those two functions it currently makes much more sense to pass the > dev_pagemap pointer and then reference the altmap from there. Otherwise > we are likely starting to look at something that would be more of a > dirty hack where we are passing a unused altmap in order to get to the > dev_pagemap so that we could populate the page. Yeah, we can't rely on the altmap, it's marked invalid in many cases.