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 B03D5C352A3 for ; Fri, 7 Feb 2020 03:22:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7589420715 for ; Fri, 7 Feb 2020 03:22:04 +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="SRUwGOdt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7589420715 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 1BB636B0003; Thu, 6 Feb 2020 22:22:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 16C0E6B0005; Thu, 6 Feb 2020 22:22:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 033386B0007; Thu, 6 Feb 2020 22:22:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0169.hostedemail.com [216.40.44.169]) by kanga.kvack.org (Postfix) with ESMTP id DBF8C6B0003 for ; Thu, 6 Feb 2020 22:22:03 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 85436180AD802 for ; Fri, 7 Feb 2020 03:22:03 +0000 (UTC) X-FDA: 76461882126.26.coil64_6915a47f43e13 X-HE-Tag: coil64_6915a47f43e13 X-Filterd-Recvd-Size: 4722 Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Fri, 7 Feb 2020 03:22:01 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id 77so811965oty.6 for ; Thu, 06 Feb 2020 19:22:01 -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=kxpaWa0+XSv/h0KyQxfmm1U0ZcFkiwyNbxIjpRoQTj8=; b=SRUwGOdtnBUCm1UeN6UybVy3HWKNJQYv6Cun4Q4qZ4+j6V03oVjWN+ymSfEBujs0Jo 7OiWUOADGWcS9B4nBOQiVrk4Wcj4pDsdQcy+lB3+jE+AaVbpZ9O0PazxSc9Ew6Jd+OvV FlwuOTU11PQ9fwf3N/HIyV2V2KzDVCHZbix3wMtLMpCkov2cy30OPk9Y6B7fOZgbuF5L wVYAe1ncis6YsTzehBRjpFT9KJ2oTkTwMuoZwYGOKjh/1IUwyrGM/+KtXCJP9grQX80x pI0n47uRF9TyeMmOkxj+UGu6cpdsd2762wBnYL0+OD4PmrwufFBhVyLVRJL/OALFmil8 GePw== 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=kxpaWa0+XSv/h0KyQxfmm1U0ZcFkiwyNbxIjpRoQTj8=; b=Lp/WPZ9u9EAzKZDhQshltyqLQ0geHf0i1hD2RIzThP/jih1y61XKKfu9JnKdHL/NOL Dwwuvla887Xk+ZcwL4+F5LcSsJzVlGpeYocgrBbppsD/NEDB8aPXJ4U0bjiuqG9QC1vv qRuD1ZreS3FuMZXrbzq8Zt+DVB1xQjEsG3xHua5nGsg531qQtrKOFt8NCn2xUoMWvRHB QgceH4jjUPQln4Bi7iJctdSXNLsEb2kCluKL6rz4dw9wJZ/CBFdOtTvIy+/5k2k2r3Fa icwKC/GEaic4B25fhR6nhBcfrh/tGmHXEpRmfL88kUnQMxuVeDll2bE5xm6gaVlRaGfN cgzw== X-Gm-Message-State: APjAAAWxLUD2v2Xgb+CWQ+NFn+ruWR1BbOxmbgoMncTduxH6e3mLTnlj NuS3W9aW/Pol9xug2eCk3bCxBX8KCjOESwDW53ntKg== X-Google-Smtp-Source: APXvYqycOOqZbrsrgZIHLorFMhqC8CHJBV/Sp+UA39PVezcTB0HsHMqFkMM4nfiqq41oArfHBA3eUly4UFh6/xuMF0o= X-Received: by 2002:a9d:7852:: with SMTP id c18mr996969otm.247.1581045721063; Thu, 06 Feb 2020 19:22:01 -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> In-Reply-To: <20200207031011.GR8965@MiWiFi-R3L-srv> From: Dan Williams Date: Thu, 6 Feb 2020 19:21:49 -0800 Message-ID: Subject: Re: [PATCH 2/3] mm/sparsemem: get physical address to page struct instead of virtual address to pfn To: Baoquan He Cc: 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 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. > Seems yes from code, but I don't find any document to prove it. check_pfn_span() enforces this requirement.