Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp122756ybv; Thu, 6 Feb 2020 19:23:10 -0800 (PST) X-Google-Smtp-Source: APXvYqz0dssexcCxmt8aXTsViyMOg+M3pF1iRDket/uS1gvjyu/Uvskhln7nwVBLR2VDKQhKRVc7 X-Received: by 2002:aca:1a06:: with SMTP id a6mr681452oia.148.1581045790370; Thu, 06 Feb 2020 19:23:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581045790; cv=none; d=google.com; s=arc-20160816; b=z2KFzR/rb/tt+S//pOddXcWai/L6nXitE8G+ca2ER3utxjQypOWDVM6Fkg+aROZZoh JIbi8j/dEdf0OdgSNsTeApH9YLQ14XlWHGHeCiUi0OaLNUpKglxHY/CFR6RAqth6Tmio KlVl86QumQHM1jGmFsPagD3fzcYl7HByckSJtBrzawzdLuUBX6nE/jnp5rPolUN6X11f xq1TGKZoHrGRJlWupRrDr0nWOdIes61swMfw5S4yN70I5AcwQSkVQjEDND4YLB0Pf5he l495RmfZjF8vaRHg/UFuyT9zGQVQEzi4pj6ny7VQwo6UjXJ3ACE3uqjlEyghGQjCRlQg /zUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=kxpaWa0+XSv/h0KyQxfmm1U0ZcFkiwyNbxIjpRoQTj8=; b=QfWetVAquf3lMSm91i4gBiZkbLnskfTgm8Z6YQqW+HbzQvXn1R9bfG3Qa3uJ8ORDTN 0hk+5iemSkctK2Le8dTaGNN4us8+SDk0GseRLwRnNY3VrOALYIZzY5jhh7SWtuns7PLZ wlYnnX1Wc/kHlS+1p7zgyzZ4bY1gRJ4IrucyECf+NREFaJaYBxJUrclhBwMXg3ZAyUIC 4dAZyRfsYp2D3TOMt8jdyFjsye5xF8gs2NEFviE/iFglBUbggH1XazldHhNx0f7YC2TH 91zBV9lwil8LWIYR8sQxWuKOjNtFsEUySSYpmVtVG5WhzlfLWP+S4GSpIl7HVj1R/vJg ANXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=SRUwGOdt; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h18si977175otj.114.2020.02.06.19.22.57; Thu, 06 Feb 2020 19:23:10 -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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=SRUwGOdt; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727123AbgBGDWC (ORCPT + 99 others); Thu, 6 Feb 2020 22:22:02 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:44143 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726956AbgBGDWC (ORCPT ); Thu, 6 Feb 2020 22:22:02 -0500 Received: by mail-ot1-f68.google.com with SMTP id h9so779791otj.11 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=uKd9p7UOj3lgG5j6qV9nDNUobs9IYyYfBsPmARHJ/pRqOM4IE5eeZXH3w83bdBEuEh 7XPjj6A4xFqFIr/c0h539LH+dDAaTjPog6k413gvRuoxMd9MUxYY9qeUTzJPZVssZmpt BvsnlJvHdIITpFdFh5gaXZfaa2FJtcXZwyBs1yuhmLKSh7Xb+aUjKW1XyXtLlxRNTb2M rOhn5m4j0nHr9lberubfgS5B1KkctbAaPuriAPJFhkAIkMrS9uENFKahFKattU7V/mhu DT12imdemKj11DLZ1NdKa4eYpw8MS5bXGO71pBS/IY+VNzMK82tY+mHifLVIH1/JChk7 pPHg== X-Gm-Message-State: APjAAAUI0QxfjDAriYh4a3XRgT85ZPWhY6psHABJR0BgaL0buwkK3kNr ua8Sg+NXx+ulNqe0mE2V/1kG+DOx60XwhjZ8JcAeCw== 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.