From patchwork Wed Jan 20 04:16:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12031427 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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 EAC64C433E0 for ; Wed, 20 Jan 2021 04:17:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7A0F62312B for ; Wed, 20 Jan 2021 04:17:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A0F62312B 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 CBC626B0007; Tue, 19 Jan 2021 23:16:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C6E1B6B0008; Tue, 19 Jan 2021 23:16:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B5C356B000A; Tue, 19 Jan 2021 23:16:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0109.hostedemail.com [216.40.44.109]) by kanga.kvack.org (Postfix) with ESMTP id 9ED4D6B0007 for ; Tue, 19 Jan 2021 23:16:59 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6EFC3824999B for ; Wed, 20 Jan 2021 04:16:59 +0000 (UTC) X-FDA: 77724842958.28.silk33_3b10f1f27557 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 4F3446D65 for ; Wed, 20 Jan 2021 04:16:59 +0000 (UTC) X-HE-Tag: silk33_3b10f1f27557 X-Filterd-Recvd-Size: 3380 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 Jan 2021 04:16:58 +0000 (UTC) IronPort-SDR: bZ3csdsPbuaubDQZrJWagmnahZsyiK82iBLDx5EVkue/Wzm2e7cpDSsM+17TS8DfVIoiLtqche vOcC7BMf/Y5w== X-IronPort-AV: E=McAfee;i="6000,8403,9869"; a="197764860" X-IronPort-AV: E=Sophos;i="5.79,360,1602572400"; d="scan'208";a="197764860" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2021 20:16:56 -0800 IronPort-SDR: T5kBBZeAKOzBG5bGQ8LN5hG+ho85Icc5hIerVXBdMbIHkAUnfAZaUedfT9sCxvlrWxPfcJqX6g Ab9hCEk2CDYA== X-IronPort-AV: E=Sophos;i="5.79,360,1602572400"; d="scan'208";a="384275314" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2021 20:16:56 -0800 Subject: [PATCH] mm: Fix ZONE_DEVICE usage in move_pfn_range_to_zone() From: Dan Williams To: akpm@linux-foundation.org Cc: Randy Dunlap , linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Tue, 19 Jan 2021 20:16:56 -0800 Message-ID: <161111619868.2787408.1710192276369197040.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 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: Randy reports the build breaks with recent additions of section_taint_zone_device() in move_pfn_range_to_zone(). Fix that by including a conditionally stubbed out zone_is_zone_device() helper. Reported-by: Randy Dunlap Signed-off-by: Dan Williams Reviewed-by: David Hildenbrand Reviewed-by: Miaohe Lin --- Andrew, apologies for the thrash. Please fold this into: mm-teach-pfn_to_online_page-about-zone_device-section-collisions.patch include/linux/mmzone.h | 12 ++++++++++++ mm/memory_hotplug.c | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 0b5c44f730b4..66ba38dae9ba 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -885,6 +885,18 @@ static inline int local_memory_node(int node_id) { return node_id; }; */ #define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones) +#ifdef CONFIG_ZONE_DEVICE +static inline bool zone_is_zone_device(struct zone *zone) +{ + return zone_idx(zone) == ZONE_DEVICE; +} +#else +static inline bool zone_is_zone_device(struct zone *zone) +{ + return false; +} +#endif + /* * Returns true if a zone has pages managed by the buddy allocator. * All the reclaim decisions have to use this function rather than diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index c78a1bef561b..710e469fb3a1 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -769,7 +769,7 @@ void __ref move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn, * ZONE_DEVICE pages in an otherwise ZONE_{NORMAL,MOVABLE} * section. */ - if (zone_idx(zone) == ZONE_DEVICE) { + if (zone_is_zone_device(zone)) { if (!IS_ALIGNED(start_pfn, PAGES_PER_SECTION)) section_taint_zone_device(start_pfn); if (!IS_ALIGNED(start_pfn + nr_pages, PAGES_PER_SECTION))