Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2067823ybv; Thu, 6 Feb 2020 15:19:17 -0800 (PST) X-Google-Smtp-Source: APXvYqyDKe6EKRcDZe8Jntd9JgF0ZhjNOXOTZX1wEWpbIXKXWb/LiHdtLZyfDOYT+XEDs6WTRSps X-Received: by 2002:a9d:6a85:: with SMTP id l5mr434000otq.231.1581031157403; Thu, 06 Feb 2020 15:19:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581031157; cv=none; d=google.com; s=arc-20160816; b=QVsxS1IrinQj1/JOK/k3Urj57WxceJ96W0AqdY9YPnD6xY5h93Inz8yPfmNcxPrVat uUZ663nX4vgYTLZJE5T2UVjEtCrFoenu2GKuDhfEtky02TggtIE2LicGyKl/h+vB42wd EAlajA/PN3+kEQpFvxZhtxm9U/8U95BiofRERehPBfiUVUhar90Q94rKSVEwHCXKG+He BUDU2qoECM1nTo29fhxeaL3Oa1q8c67KSFp7B//x4qNEdgjmjO7f6XtGioioJbK2xNRL F4DTegIM+rn7SMB1zTIeiEMqv3sJZDFWGFOQ21F4khErkrKSiKxxXQ4XsrqjdUZKFtjv gBaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=FoN8pQc2K9qO2thQqx+xYoqWCW6eGIj4bIgjF4jGtag=; b=U5yrYIXwMOGR+VXCoEAWfk39MZRFLeSrzpMLjh5RO4TKprrQV7PS82tcjD0SgczuYy YhWhFBDLGEWlHEKZprFTLejnM5YMNjQtCH6vatzYkDLhQBrRKTaVzLoWLbRh0xIaIxco RQJhC6RpAqLHnktNPT0l6yja78Ip+RM4Z+RMZOpQDYFvH8gSbPJpzdLp2NJTGVgL/+Xc xRMp++XtLw3SEpdM7Wxn7tkM7I2GjTY2uzqcT7Ic2zmli2hlPFBq8jNDSR/IFeHch/7t rnIEQL8c0ACvgOVSwcSvefDSgQz4RH4/FKoayu3mSxHfP2opPbAuBmZCzGy9j+fnBnWp vSJA== ARC-Authentication-Results: i=1; mx.google.com; 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 j20si597974otp.147.2020.02.06.15.18.58; Thu, 06 Feb 2020 15:19:17 -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; 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 S1727028AbgBFXRf (ORCPT + 99 others); Thu, 6 Feb 2020 18:17:35 -0500 Received: from mga03.intel.com ([134.134.136.65]:6959 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726509AbgBFXRe (ORCPT ); Thu, 6 Feb 2020 18:17:34 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Feb 2020 15:17:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,411,1574150400"; d="scan'208";a="232200537" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga003.jf.intel.com with ESMTP; 06 Feb 2020 15:17:32 -0800 From: Wei Yang To: akpm@linux-foundation.org, osalvador@suse.de, dan.j.williams@intel.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, bhe@redhat.com, david@redhat.com, Wei Yang Subject: [PATCH 1/3] mm/sparsemem: adjust memmap only for SPARSEMEM_VMEMMAP Date: Fri, 7 Feb 2020 07:16:27 +0800 Message-Id: <20200206231629.14151-2-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200206231629.14151-1-richardw.yang@linux.intel.com> References: <20200206231629.14151-1-richardw.yang@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Only when SPARSEMEM_VMEMMAP is set, memmap returned from section_activate() points to sub-section page struct. Otherwise, memmap already points to the whole section page struct. This means only for SPARSEMEM_VMEMMAP, we need to adjust memmap for sub-section case. Fixes: ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug") Signed-off-by: Wei Yang CC: Dan Williams --- mm/sparse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/sparse.c b/mm/sparse.c index 586d85662978..b5da121bdd6e 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -886,7 +886,8 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn, section_mark_present(ms); /* Align memmap to section boundary in the subsection case */ - if (section_nr_to_pfn(section_nr) != start_pfn) + if (IS_ENABLED(CONFIG_SPARSEMEM_VMEMMAP) && + section_nr_to_pfn(section_nr) != start_pfn) memmap = pfn_to_kaddr(section_nr_to_pfn(section_nr)); sparse_init_one_section(ms, section_nr, memmap, ms->usage, 0); -- 2.17.1