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=-5.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 626C3C3F68F for ; Fri, 7 Feb 2020 11:13:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 26AE9217BA for ; Fri, 7 Feb 2020 11:13:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N8bpL4uv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26AE9217BA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AE41C6B0003; Fri, 7 Feb 2020 06:13:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A93096B0005; Fri, 7 Feb 2020 06:13:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 981E36B0007; Fri, 7 Feb 2020 06:13:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0191.hostedemail.com [216.40.44.191]) by kanga.kvack.org (Postfix) with ESMTP id 7F1DB6B0003 for ; Fri, 7 Feb 2020 06:13:40 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2D15B8248D51 for ; Fri, 7 Feb 2020 11:13:40 +0000 (UTC) X-FDA: 76463070600.11.road67_2d8c15fbe00d X-HE-Tag: road67_2d8c15fbe00d X-Filterd-Recvd-Size: 5887 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Fri, 7 Feb 2020 11:13:38 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id m10so2954189wmc.0 for ; Fri, 07 Feb 2020 03:13:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=QknLuFso+EjeVasobDT6tf+o7TVotTuV29a6UTTUovA=; b=N8bpL4uv0++S1xr0+cesInouAUzyHeV96mNcy+kpei91X8w8zcqO8DNewaAByyIQjt yVLDIA9UQ9Q4hCJ2anN7XdtkCHytHOp6tMTB7h5g9gkvqNKp82ayg6EpQFehNN397ihL M8oIDy6JYf9ZDQlJjbR+cel4AdFW2GjPMF3QhaOUpXokd0lPBmgP5QAxrU2+2et8NCCf O9RfZDq/FcziEKaCnSt+lZ/opPjAoMpp9ut82QxwEqQh7QlYadhs2OxZc0gYV2tFsqu7 VjDFLouHpmQO5pKo3glOAzSClGa7RDVUrj/iR2A1XJdWF3U/QX00XwmokgD5CkBjF8yT nnfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=QknLuFso+EjeVasobDT6tf+o7TVotTuV29a6UTTUovA=; b=SiSp3g8HtWs4yUmbaNbMlQ9GzLvkjDIaNduCqCGuLbw59MVs4x2T5Ccn2DCkHR5kF1 1qI6e4wht7In9xBpu3E5vgS5+j6+pw8kFNJGVHzW0q4kB6SfRX93q+7L8JqTC5ngdSge pOriGbf7JbVl41sgOmCdagRkFZSr2TH8/l2Ma3AJicqI0VdweJUNMa5ctfuG/+VQwHHT n7QoIYb2dDFUghm8VvEr6kocYo8oZpg07dlHq+oK9XZic8LpsXYnU5/IonIgYUlN3jbV JyYjHDX+BjzmuQYYzIhLwU5XjojCcfT1HiZKIEyYEE6teDIYKs5FrQvkZmHeah3Lxf20 pgjQ== X-Gm-Message-State: APjAAAVeS8uXEAlrASAq5rs27YgmE+1p2ybpJfNlW8o59MHxSZSkBq55 E0y3zZJt9HXXJg3Udl4K014= X-Google-Smtp-Source: APXvYqzYRigbJrYG+TPi9gzBXAlpgwW5tXJ+db807JSjsO+hHYou47MN83jEUR047SO6LqTkgF4PGw== X-Received: by 2002:a1c:9c87:: with SMTP id f129mr4054000wme.26.1581074017905; Fri, 07 Feb 2020 03:13:37 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a16sm2882233wrx.87.2020.02.07.03.13.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2020 03:13:37 -0800 (PST) Date: Fri, 7 Feb 2020 11:13:37 +0000 From: Wei Yang To: Baoquan He Cc: Dan Williams , Wei Yang , Andrew Morton , Oscar Salvador , Linux MM , Linux Kernel Mailing List , David Hildenbrand Subject: Re: [PATCH 2/3] mm/sparsemem: get physical address to page struct instead of virtual address to pfn Message-ID: <20200207111337.bqahz3ex65ggu2ri@master> Reply-To: Wei Yang References: <20200206231629.14151-1-richardw.yang@linux.intel.com> <20200206231629.14151-3-richardw.yang@linux.intel.com> <20200207031011.GR8965@MiWiFi-R3L-srv> <20200207033636.GS8965@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200207033636.GS8965@MiWiFi-R3L-srv> User-Agent: NeoMutt/20170113 (1.7.2) 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 07, 2020 at 11:36:36AM +0800, Baoquan He wrote: >On 02/06/20 at 07:21pm, 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? > >I think no, the lost memmap should only happen in vmemmap case. > >> >> > By the way, sub-section support is only valid in vmemmap case, right? >> >> Yes. >> >> > Seems yes from code, but I don't find any document to prove it. >> >> check_pfn_span() enforces this requirement. I saw this function, but those combination of vmemmap and !vmemmap make my brain not work properly. > >Thanks for your confirmation. Do you mind if I add some document >sentences somewhere make clear this? Thanks, hope this would help the future audience. -- Wei Yang Help you, Help me