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 C47A0C3F68F for ; Fri, 7 Feb 2020 04:05:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 87BC222464 for ; Fri, 7 Feb 2020 04:05:50 +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="1rL8Wdo/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87BC222464 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 3222A6B008C; Thu, 6 Feb 2020 23:05:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D2A76B0093; Thu, 6 Feb 2020 23:05:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20DFB6B0095; Thu, 6 Feb 2020 23:05:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0198.hostedemail.com [216.40.44.198]) by kanga.kvack.org (Postfix) with ESMTP id 07C2D6B008C for ; Thu, 6 Feb 2020 23:05:50 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id B587F283D for ; Fri, 7 Feb 2020 04:05:49 +0000 (UTC) X-FDA: 76461992418.24.bead87_32ce7d6adb60e X-HE-Tag: bead87_32ce7d6adb60e X-Filterd-Recvd-Size: 5331 Received: from mail-oi1-f196.google.com (mail-oi1-f196.google.com [209.85.167.196]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Fri, 7 Feb 2020 04:05:48 +0000 (UTC) Received: by mail-oi1-f196.google.com with SMTP id j132so738551oih.9 for ; Thu, 06 Feb 2020 20:05:48 -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=cpd417pmla8xBu1RjMHRvWNYHG4LX3DmsJ9QusfXKc4=; b=1rL8Wdo/5eIm7IoF28G2FUHnSYk0XpmnaHZzJWrYUvY+Tm2f0F2zJmDp8CfFxmEGjL pnzS70GtljKulQZGbhcBvJJDgkhx3+bap+isASnFzIpyrB26goh/03igzV1b6E24z7Dk dqujhitlEXnHYWPI5fuaWE7LiGvCTPzkoZGt845Ftzg09EelaKpXzZ4nClqujuskgQo2 WZ0GK7DsHBhg+7naaIoaxKbDBpbNdFo3t0Ev43wfqgtoCjH9WQ/dtf+yqn2RCkqVQ1K+ +yf8xQEAVnPTDNpdkee14SUSovbqXaDaO6mrt+ASppf/yP+pBtUai08+KOhDKtXbBTZR UD0w== 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=cpd417pmla8xBu1RjMHRvWNYHG4LX3DmsJ9QusfXKc4=; b=HV8oZOEZ9wH/n4oDt/WRij7vWV6zVSSCv++DtIlcbS0laFgW5/CaA48Swe9D+P1jlA BnxawX7dytksvWnAcwZlQgT8kSmqbW4gZc+FHuY/IzwVdplyIir87tuQbn8CAZ8PJ1NV 0XDDRhlLuTLy/ZRnLUpmvgNem9ls9h8KU7Mc3Tg5VICc67Szor5xigEjLc2k1RE8xA9Q R2GlxwTZWPPgcJa+9QShk7lT4gbJ9tVDdzVBodV3pjw5DOU2wcBAmcKpSp9WNxQQcbMo W/CkSCCaTmB8tUvC+uLyMhCsoeWq/VziwLzWD8splS/RPD1w0rjRSwUGGX5ylq4neUUA 7MkA== X-Gm-Message-State: APjAAAWiWWAwizvPCaeVoN+v9OOKY97RRtyfmqPDN+QMERE5QbYQvoCb VbcPx3GBKJDa0alPQ+Bh/6ghv+F7coohj5dLkb93Zw== X-Google-Smtp-Source: APXvYqzuD5vb2b4+PvPNDgqgs4e4BOi3l9N4zVUFZJyrhfz4FPZZX4melafcYP/sZMbIAT1KeYflNG9MIbAD8PIugU8= X-Received: by 2002:a05:6808:a83:: with SMTP id q3mr850210oij.0.1581048348209; Thu, 06 Feb 2020 20:05:48 -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> <20200207033636.GS8965@MiWiFi-R3L-srv> In-Reply-To: <20200207033636.GS8965@MiWiFi-R3L-srv> From: Dan Williams Date: Thu, 6 Feb 2020 20:05:36 -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:36 PM 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. > > Thanks for your confirmation. Do you mind if I add some document > sentences somewhere make clear this? > Sure, I'd be happy to review as well.