From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D07BC677FC for ; Thu, 11 Oct 2018 18:22:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F1952054F for ; Thu, 11 Oct 2018 18:22:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="RJ7fcdb6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F1952054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728972AbeJLBug (ORCPT ); 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-Google-Smtp-Source: ACcGV63w6/tMbcJzCvJCEZiSSsclD3k7zS6FJcVYnJWwr2tYglIz10jIrfkmiaoPJSXBPb2aOVFBJrO6VNf2dW2YMJA= 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.