Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp544877ybv; Fri, 7 Feb 2020 04:16:25 -0800 (PST) X-Google-Smtp-Source: APXvYqz3blZUcAR+JaYuMRfVTcuLbX7JuIt1sTGzHKwJgwI89wlyuaSDTpyeYJmel6APp2ca3mTr X-Received: by 2002:a05:6830:1e30:: with SMTP id t16mr2504921otr.220.1581077784987; Fri, 07 Feb 2020 04:16:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581077784; cv=none; d=google.com; s=arc-20160816; b=d6NJnOeKbl/5tbhsqdb+VYHZMBKWPzAXX6u7gYKFy+N+qWMLqbJ06TTFFYA4oVq55G xZsOTY5d8CqMdC4mj5kP4jDRFfdAAOPOLQ1bmdk7bLXI6DPcBhCuELQQmyNOYqgErspW sultD7/P3zBsllVwdilOgV2JgKNognI3YwccXeyMoLuRqAd51/VLD7Vh4LU6+eBQRGXj gnV9V+P+LqWtOpeoCSFCIgSnHjiz6Vut8zYNzFqof3PM16xKNcEpy9LCem1+0RQQhQhw cOrG0mz8/S4t3Nho8gKnF8xedanzyGRf9fKYcPi4mSmRzU+2C4cK8ws/ELoPdwZegXc8 y5nw== 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=D+DJ3MiV/rAwduMcYLUzMxxDEjOIvkp9prmU1gHjEWI=; b=LSMSGQMcz0NTnKFUsuqvBeYnv/9MnAc03/pepNb+OYMXgjcpPdG5i2dWIJNlKtKmAe WcS6JwQI4RCGYRCwfh/XwHqbeWKfE5aGVoak1qS2e/op/nSqEFN/ky7qzyebsdaEzjrC QEPoYcWTtE+9f7EYRXh8Cx6dloyo49Eza3nhPWS2jwqY1KCnLiL6THnJyOr7U21sL+rX D0VUFj86uzDhiOqHP/5B4QZYcILjTQHqi31KuMJp4jakBdQOO3Dmh6rtsaGm4KCqDp+X HMn+F5kKNd/Zz83xvq9fkPqGWPjnyIkuvkfrKUk4wvf5x8gS1WFSM97xH0fQodUS2MgR l1Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="EZW0vVT/"; 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 19si3817999oiq.128.2020.02.07.04.16.12; Fri, 07 Feb 2020 04:16:24 -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="EZW0vVT/"; 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 S1727379AbgBGMO6 (ORCPT + 99 others); Fri, 7 Feb 2020 07:14:58 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46320 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726894AbgBGMO5 (ORCPT ); Fri, 7 Feb 2020 07:14:57 -0500 Received: by mail-wr1-f66.google.com with SMTP id z7so2377709wrl.13 for ; Fri, 07 Feb 2020 04:14:55 -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=D+DJ3MiV/rAwduMcYLUzMxxDEjOIvkp9prmU1gHjEWI=; b=EZW0vVT/8ToglsskcvB7pO/NK/uGzBxoZFPvWQwkUOpSUBe6+BTaL27aLeRY7TzBOd oDISQbFTS93cmfBmWo8eUwPN3PWSP0kC0GDNvfUaGziNAoN6lc/AELr41KV6HQIHqCBc JIEmXiZIfUDNUx5mPqKZVGTCmXIHbOIanuS+i6QnxSAK+X5Mg830zPZg56BbFDkpYE+k B8wlLl8FdHn1CWZV2hXWLmeiNeBPYOquQ8L0OUKHVIeahpE/aoWCO0sLx6vskGsM99SH Wk5tvPOykdJHURYkNgVIebtbEzeq+N2PNJsF+/fmBTWEvH9NGsJqqH8XSLqpn+vIw4Xx GLAA== 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=D+DJ3MiV/rAwduMcYLUzMxxDEjOIvkp9prmU1gHjEWI=; b=HnF0o3sKFE3IrUH14pXIp9+3oKtEl567GhPXXuFYQpWY8KqmIFkmUFvOiA8FqparBA isy1vikwmCyt9bt3VP048XuLsjIATQbX2ZCNH7/TeOuS+cieQDQF6sHNy8X9njmboh3q vxhGu6tfgSCZG3pxrQ6+8tM1UgnUGHuZrTKl7nToQv4g6wJVpRwI4T99+uNk227zPP8J IYFujv0Q2hZECI2qzcOmQlraSXZC5uNJ4VJ2Alq+7YuQ4NkMIjVlNDVBguhXPFZ2lONk m8WiC/Z5J0kaIkO+aKxoRI+lPYCGZsCDoWaGNUokaTeqaC4NnvzBDfgpGzav2/TvliBt 23Ow== X-Gm-Message-State: APjAAAXbFkAF9Yw46CmrwONfwdLfOfwEjtye8mXSF1P0fU/9ofxQDzRn FWfLGKeW3hUo23t6wRY2mpQ= X-Received: by 2002:adf:c54e:: with SMTP id s14mr4271269wrf.385.1581077694469; Fri, 07 Feb 2020 04:14:54 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id y12sm3175421wmj.6.2020.02.07.04.14.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2020 04:14:53 -0800 (PST) Date: Fri, 7 Feb 2020 12:14:53 +0000 From: Wei Yang To: Dan Williams Cc: Baoquan He , 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: <20200207121453.pgi4axyvx6peqgeo@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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? > >> Seems yes from code, but I don't find any document to prove it. > >check_pfn_span() enforces this requirement. -- Wei Yang Help you, Help me