Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3295018pxb; Tue, 19 Jan 2021 20:25:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQn+AKWKEVZWO4hf3DoaT3XniSSZRG/jQIuIzsGA4CFahdeuD4wu7kKIZ9rgXN7+TShfaY X-Received: by 2002:a05:6402:8cd:: with SMTP id d13mr2726288edz.335.1611116703219; Tue, 19 Jan 2021 20:25:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611116703; cv=none; d=google.com; s=arc-20160816; b=bfit1/Dgvg2UJew9OS9LgTD2Ctli0Za9yQh/3y5h4nTWubOgsZ2jC6Agv1Zoq+rla4 l9cdNJ/qZuYaxE5nj6/awcyPmJ3iHyeaQ4gTjs25XSimr0xVxID6bnccYji3Z5y9vWs0 gFjyiGBLtYoo5hy/8JRNf+c5fMI1nDZfVdEfl5zQY+eGEp+8OgVwEAveFbRcfVJlNd/e 9c81gDctdfTrzhFac8T1N49Zvz56y1VOnNxCAByzhLFyGFVfllEOhmmVeMyh0ja6/fNh cz+rew40iVM2NJ8Kpln/R8CjcSDuyyjaT6Atv1qQ7PGLgR1fr42KVAlkpFOzejBrWTHu fCXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject:ironport-sdr :ironport-sdr; bh=J7wQvWPiKjiUA/zw6UunQNgzzaOAAG4DnLXKKBiUJSc=; b=qoCPBUn4dX1dLKoal9PUTLzsfxZzywo33bE5OT2H89hN02SBqkeXEE3WAtz/WLnqga ezuo+QME9ur6AlVjIJsm7qugY/BGAOMxtPphDSfr1/XvGUwviYnsU0cXeyUmBZRgrRMd 6Ds2qD0nvTBi1lPJhXXh7xnBZxIDBdHM88Z8p082g4rM/v2I38+dKaX3FPDI8fwzc4f7 vdSgXQVcBXvEO9w8/7UzF9HoRxW8klFll4yaRTvPGuXhCilwAoc4fo6VCSE0Sroks9fX 8aWqRGWyrGZPq8sxArVELAp34BGnS858ABfn9gDabCE4QZ9og79BBnlpT+wMd/Yu9RGo KUoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id r15si284590ejs.502.2021.01.19.20.24.39; Tue, 19 Jan 2021 20:25:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1730635AbhATEVL (ORCPT + 99 others); Tue, 19 Jan 2021 23:21:11 -0500 Received: from mga12.intel.com ([192.55.52.136]:44841 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728538AbhATERi (ORCPT ); Tue, 19 Jan 2021 23:17:38 -0500 IronPort-SDR: VsBgo9L+9VXslz1N6ZGpRk8qdMw1FC7Nc25gOBX+wDcbovc5FrL3rU1Yt6AEmUJ8cApggoaMqm GOy7jVRsJTzg== X-IronPort-AV: E=McAfee;i="6000,8403,9869"; a="158222171" X-IronPort-AV: E=Sophos;i="5.79,360,1602572400"; d="scan'208";a="158222171" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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))