Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp491602ybv; Fri, 7 Feb 2020 03:14:50 -0800 (PST) X-Google-Smtp-Source: APXvYqxdQqr7zJeMXKl28USEnhwPrWoZ1UaeZg7EER6qEOj2n9XzVbODE1szUa3dO2vzumV1hJvG X-Received: by 2002:a9d:7f11:: with SMTP id j17mr2344471otq.281.1581074090676; Fri, 07 Feb 2020 03:14:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581074090; cv=none; d=google.com; s=arc-20160816; b=gMECrlLAwjwVLNh+mo1/J2qw6aMfYnLtT6N9A+DdPwn6/Mgqx1gHxeDu2dp/1OehdA VgrtoP0UO155a8YtBqagQNqpN3F7dMEnBLqySEdV/eTsl5OYKyYFi8bmXBsClm4Z1hS2 Wys50jMLYAPdjt+I63RpcRq4JTge3/ReG8IHk2d7rV7FnHg8hCsePU6/rsZlaCThqWwT Oi4IOHPGHEUi3DbO1T7nXZt/ke2XluWTNs8kBziIDOaQP5jFVzIMsfHBZzAyLWP+6Mvv sCHiRXvsKg/8EIj4XKSpeed2VUf2GNdVOiMqCLBvV5qPOcic5B3bLg87liX6YHYjOC1p fWZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=QknLuFso+EjeVasobDT6tf+o7TVotTuV29a6UTTUovA=; b=wpGwe3FrMYrPrE8JpDne/RP1/UhpDOgFEuBqIVqSXGsz35TXYH/c9theyxERfzmkx2 5yf1ZJcA91/bmijbX2KUknIWEgQtEj+PHs5pUhys19V9EpVOviyQcYhv/BexoacqBFCm d4tNRZt93PosvPLlbRjvj+bwsDyT+XRUKTKIgY2rA3MIlc5mSb1TH8ZC37EofrBqefe+ +m3Y9cFOAILG1GUxIg0TnnGyQjB3nQGtyk6pLCKHZaUtTRNCUHb3A9hVawMQMjukQKiU RpQDNvmfR815zPmqj6Xk6G4A7d/v6zwIQuldmV0Qn2+sFdyKvHZmwrNFUwokE+M/f/on sK7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N8bpL4uv; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si1520062otr.207.2020.02.07.03.14.38; Fri, 07 Feb 2020 03:14:50 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=N8bpL4uv; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726874AbgBGLNk (ORCPT + 99 others); Fri, 7 Feb 2020 06:13:40 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34668 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726674AbgBGLNj (ORCPT ); Fri, 7 Feb 2020 06:13:39 -0500 Received: by mail-wm1-f66.google.com with SMTP id s144so2953090wme.1 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=nZCmzjAXtygdajXOjkPXROQnYBUw3SZcAg6u9OE/5zoYK5OFOA8qMM3KVKB6xIj3u/ u1C8ZzM8OPZ5yymoeHMkQKq57NjvLu5sfLsmDPb6Ot1LadU1mtQFi4+yhmibys2VSjRp JZRzYp1Uj2u60lR/6a/GCmh+w349DETK0dSQLDMwQFdyvTIh82yBW7kNzutb26xeu8nh Py+bXJw6PPPpd8vXub1QLTRVm603or3f2M0GR36kMbnUuThdXrScdErLU3eouU4WIpIA gILqLkZ7YcQ/u8SDkZLNn87IAnCgnDLwmVPjHzMjkj7w8ANgHfEZpRQTuCkZk5ENUVrb QB/Q== X-Gm-Message-State: APjAAAW/eBNXPzfbSJaFY+Pf6KgP+Wyt3B5wRWH124MqNw5sF6aSutCJ J5gDhDTZS+XwU77CUuvR0EM= 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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