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=-6.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 BBBF1C35247 for ; Fri, 7 Feb 2020 02:20:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6DAA7222C2 for ; Fri, 7 Feb 2020 02:20:00 +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="repA3BNU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DAA7222C2 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 126BA6B0003; Thu, 6 Feb 2020 21:20:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0E3386B0005; Thu, 6 Feb 2020 21:20:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F2F9D6B0007; Thu, 6 Feb 2020 21:19:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0114.hostedemail.com [216.40.44.114]) by kanga.kvack.org (Postfix) with ESMTP id DB83F6B0003 for ; Thu, 6 Feb 2020 21:19:59 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 92B02180AD801 for ; Fri, 7 Feb 2020 02:19:59 +0000 (UTC) X-FDA: 76461725718.03.look27_91667206ff211 X-HE-Tag: look27_91667206ff211 X-Filterd-Recvd-Size: 4242 Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Fri, 7 Feb 2020 02:19:59 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id j20so723152otq.3 for ; Thu, 06 Feb 2020 18:19:58 -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=4bNX4611c68uTPwlDqh0AwoeptlDyMNJDpCMpisti+U=; b=repA3BNU8ntMmnv8TjrpEXQJYxL5dZe64rkBCGIJiTUOpJ30PucDwFrQHjkbWbbVlh kqj6hAN1Lr47QyPyFDBvom55wVefzJhj3bqFR88zHyhMbXA8o+7Ea2swJ3cRaHyyvWtu GRqE5Xo2lNjzlVFpVsEfSuJz1hJ191Yi6GjOwxCjb7VS2gz4y0L9G3EjLZsyQRuJNdOJ 2ItaiJQ0m/06GVvsSbh88b/NL8TVu2WC5WGBEnpqY+UR7Ao3RpDX/yVcntNwTKnLFd1n 8UJjUT8W3xFhVWHiutMllEoPZA6f992LvEcG8CBWTBch6lTqsbxHf4OivobD8SG9sKfU 72zA== 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=4bNX4611c68uTPwlDqh0AwoeptlDyMNJDpCMpisti+U=; b=jIIhOAoVKdOlC851xTft8xMKTqzj3znFOUZaXzPmC9YnYjZpyDPOiHPqKWS2oJAM// JHOUJU8xIV6QHLVLRcXfIJxvFgH5dDQKXEK9HYFfx7SO8s56w654gxF1zN5oZz29Hvro cw3eOO1T4iAd/Gdtpevg47t9X3bTssQ4qL8q0UhjV+3w9oEOkYG+2DKhjlwucXhPwMTC FDFPxKMs5f2I+jgyO8+dXK+7c9ccZE3rdzBz690i1gVJZS05JXKzp5koJzDLeSPi4Pgf wGwCZ5eSp/GhyJ02gxy0VjIejSHXtcRENTAwuEz40yIikbsE/9y6xnwEfxn9Squ6kFH9 Vzqw== X-Gm-Message-State: APjAAAXufvqC8LYcE3sxOR/BupxGtramVrFxRopbA5bFPAXXheCiM843 q4m5IqXkREAKdEjFgRsVspAigzMIzt5cbQ4BbdOAaw== X-Google-Smtp-Source: APXvYqyjoEgUDaBh2BqyNmMSzARPpTofPD+BGuupmiBWVJWPiaG8w1TxuQ92MR5Hbrrp+mGIzwdhfnHJwud8ycxi84g= X-Received: by 2002:a9d:64d8:: with SMTP id n24mr865991otl.71.1581041997813; Thu, 06 Feb 2020 18:19:57 -0800 (PST) MIME-Version: 1.0 References: <20200206231629.14151-1-richardw.yang@linux.intel.com> <20200206231629.14151-3-richardw.yang@linux.intel.com> In-Reply-To: <20200206231629.14151-3-richardw.yang@linux.intel.com> From: Dan Williams Date: Thu, 6 Feb 2020 18:19:46 -0800 Message-ID: Subject: Re: [PATCH 2/3] mm/sparsemem: get physical address to page struct instead of virtual address to pfn To: Wei Yang Cc: Andrew Morton , Oscar Salvador , Linux MM , Linux Kernel Mailing List , Baoquan He , 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 3:17 PM Wei Yang wrote: > > memmap should be the physical address to page struct instead of virtual > address to pfn. > > Since we call this only for SPARSEMEM_VMEMMAP, pfn_to_page() is valid at > this point. > > Fixes: ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug") > Signed-off-by: Wei Yang > CC: Dan Williams > --- > mm/sparse.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > 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.