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=-3.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 BD950C2BA83 for ; Fri, 7 Feb 2020 16:45:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5DD3421741 for ; Fri, 7 Feb 2020 16:45:11 +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="OlrtI16M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DD3421741 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DB9CA6B0003; Fri, 7 Feb 2020 11:45:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D90356B0006; Fri, 7 Feb 2020 11:45:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA5D06B0007; Fri, 7 Feb 2020 11:45:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0039.hostedemail.com [216.40.44.39]) by kanga.kvack.org (Postfix) with ESMTP id B29E56B0003 for ; Fri, 7 Feb 2020 11:45:10 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4C147180AD802 for ; Fri, 7 Feb 2020 16:45:10 +0000 (UTC) X-FDA: 76463905980.23.use54_845510f6a263c X-HE-Tag: use54_845510f6a263c X-Filterd-Recvd-Size: 5204 Received: from mail-oi1-f195.google.com (mail-oi1-f195.google.com [209.85.167.195]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Fri, 7 Feb 2020 16:45:09 +0000 (UTC) Received: by mail-oi1-f195.google.com with SMTP id v19so2543416oic.12 for ; Fri, 07 Feb 2020 08:45:08 -0800 (PST) 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=rIOuP/1Ysr2MuixCGeN5opf7BC+IIc7SOpxNoaJ25FU=; b=OlrtI16MC0ud/tLym/B8Vg0C2/zcuEAfJ6/hNyd5RIQM4tAjVNYb3zY1VSpb5/ZCUa kRPPVciTb4JZ43LXuOse1RpL1Y8rLZulnxdNpVMdqEDc3OxG9H0RWx/1IoitGDloRa+s 0AeQuckcBFd5uC/gKLrLoWoXEbxO39XqIBPFYr4/M3k9Z2koBjgZV4PXWow4ZHY90wr+ 6INZJuHQpTK/jX4fS+Pua80XHY6aT7WA8UM/1YIMvts4JTvmA1TT5afQhWQj3ThnE7HG xD1nBbgcNpyQ3wpNd6KfDJA8g5wdyglKkvx+x1Lsg3Rxp6+gTJtexD5NRTuIff+V/Q3r YSGg== 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=rIOuP/1Ysr2MuixCGeN5opf7BC+IIc7SOpxNoaJ25FU=; b=GJaUIMD7pe2FNVHRraef3TqKacI1lvKJF+zNGbYK+ME7rwjipNe+Rc/AB4npuRt01w 9w3xz7MvMatTHzOLN2oaNpoNW2wkOY2WnKUq7iEeo0uIRffeOrdD2PG6w7jPprq/uxrw jto/BATvEQDJVmSAP6FfpzN49wNhN/OrAcmzfNsshSWLmTO3QzA/83jPZ16eusgAxz07 CXAexCZ35D+xuJ8M4sWK3uhQlCVY8RdhiWggIk9JeSswp3UW5PfWnTx+OI4akx4/l00h njRWYnNBGUJfR9PLfDewSSpRCYe9ouICRJ9IHSuNM7AOBTVj0IO/KYLEa8i31bsKePcH 7auw== X-Gm-Message-State: APjAAAXJamZK6+D5TsqGcX5uStDorhgz27oNeIym7smPTfq0GPOXQZoJ G54451GpPBngZeflX9IbAFzIOlw47hLR0oRMFPeXfA== X-Google-Smtp-Source: APXvYqxsMTWD5WBM7p8k2Cf41qlGp2RBbdRfszi0IrIxgyPD9ETBPv5usWBVIvnJUWaZ3/0IkPif6As8KKN61jxSHFU= X-Received: by 2002:aca:aa0e:: with SMTP id t14mr2694999oie.149.1581093908242; Fri, 07 Feb 2020 08:45:08 -0800 (PST) MIME-Version: 1.0 References: <20200206231629.14151-1-richardw.yang@linux.intel.com> <20200206231629.14151-3-richardw.yang@linux.intel.com> <20200207031011.GR8965@MiWiFi-R3L-srv> <20200207121453.pgi4axyvx6peqgeo@master> In-Reply-To: <20200207121453.pgi4axyvx6peqgeo@master> From: Dan Williams Date: Fri, 7 Feb 2020 08:44:57 -0800 Message-ID: Subject: Re: [PATCH 2/3] mm/sparsemem: get physical address to page struct instead of virtual address to pfn To: Wei Yang Cc: Baoquan He , Wei Yang , Andrew Morton , Oscar Salvador , Linux MM , Linux Kernel Mailing List , David Hildenbrand Content-Type: text/plain; charset="UTF-8" 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: On Fri, Feb 7, 2020 at 4:15 AM Wei Yang wrote: > > On Thu, Feb 06, 2020 at 07:21:49PM -0800, Dan Williams wrote: > >On Thu, Feb 6, 2020 at 7:10 PM Baoquan He wrote: > >> > >> Hi Dan, > >> > >> On 02/06/20 at 06:19pm, Dan Williams wrote: > >> > On Thu, Feb 6, 2020 at 3:17 PM Wei Yang wrote: > >> > > diff --git a/mm/sparse.c b/mm/sparse.c > >> > > index b5da121bdd6e..56816f653588 100644 > >> > > --- a/mm/sparse.c > >> > > +++ b/mm/sparse.c > >> > > @@ -888,7 +888,7 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn, > >> > > /* Align memmap to section boundary in the subsection case */ > >> > > if (IS_ENABLED(CONFIG_SPARSEMEM_VMEMMAP) && > >> > > section_nr_to_pfn(section_nr) != start_pfn) > >> > > - memmap = pfn_to_kaddr(section_nr_to_pfn(section_nr)); > >> > > + memmap = pfn_to_page(section_nr_to_pfn(section_nr)); > >> > > >> > Yes, this looks obviously correct. This might be tripping up > >> > makedumpfile. Do you see any practical effects of this bug? The kernel > >> > mostly avoids ->section_mem_map in the vmemmap case and in the > >> > !vmemmap case section_nr_to_pfn(section_nr) should always equal > >> > start_pfn. > >> > >> The practical effects is that the memmap for the first unaligned section will be lost > >> when destroy namespace to hot remove it. Because we encode the ->section_mem_map > >> into mem_section, and get memmap from the related mem_section to free it in > >> section_deactivate(). In fact in vmemmap, we don't need to encode the ->section_mem_map > >> with memmap. > > > >Right, but can you actually trigger that in the SPARSEMEM_VMEMMAP=n case? > > > >> By the way, sub-section support is only valid in vmemmap case, right? > > > >Yes. > > Just one question from curiosity. Why we don't want sub-section for !vmemmap > case? Because it will wast memory for memmap? The effort and maintenance burden outweighs the benefit.