Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3293656pxb; Tue, 19 Jan 2021 20:21:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYsLgzN1PbplSQXvdYxmHJ2NSutFKk7sYTJ7rW49IFok4YM7eZ51GAv6xbzrap0bMOyPM8 X-Received: by 2002:aa7:d045:: with SMTP id n5mr5895908edo.306.1611116502616; Tue, 19 Jan 2021 20:21:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611116502; cv=none; d=google.com; s=arc-20160816; b=Z2S4TiPMmBqcsD8bc2sAA87EAgO0/QTEjj2kI2tgbBQNfg/PvmKX+h8TyuiwlgV2Dz 3pbuEEBvVtBQDQFZyaNDJagnjiH2ewAlsKdf7DKPIP/+jWHBaimDt42fqjBy0zFVmiCm 6DZACV7zqjo9FMPHhJ6VIM9BBz+kcfCQazBhyCUfbrnY+sfUqmRk3IL5oTlDNFz4RHNI HStJC6xt7OkhrFEh0FGKSBjiZCibOBkYwE8Ku4v+UQuyNuOQwF3RU/vPpeLL7cmvfRpS EKR38Kr91xrvfAK2mde/k9YZXi2VnimxkJXn1+/vHJIm+d0nx03ZW66E6IgVLQ3dqz/7 YEaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=l9avflWFeErte6PCdfopkFmndIBocFK+Q/nYZfMSQqE=; b=iL5qMJ/a/IggiR5fURLZ1duCZfgMVDSuO5E1amhvdNuMZ0iG4Pg52mo+O0yyk5ZRAV SAvx1FrhmT8Ugbu4MB3S3zKYaDJrVVeZ9zKCyAwnocGgEzyIFtdhfAPbQrIjLUTPh7wH oD2mVe8jAeCB2uqaMucdQZw3YhlSA4MvHduA0LbfJIsK8hCa01Yth9AE7hIe9PD7gt0e BblO5WlW7D/KBNMAtsSf70FbyySN3jydREJLaFkJp/SPQAEGCb8ymje5MCA1Tm5dQLer HqGd1PeIzM0oKodDohjgsNzO6HAUlFeaztrx22zA4CpzE4bxajB9K9Q6eyiLgHT6LWqo whNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=C8X9zRKk; 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 js10si286744ejc.446.2021.01.19.20.21.18; Tue, 19 Jan 2021 20:21:42 -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; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=C8X9zRKk; 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 S1728240AbhATETH (ORCPT + 99 others); Tue, 19 Jan 2021 23:19:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730692AbhATEMw (ORCPT ); Tue, 19 Jan 2021 23:12:52 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64DABC061757 for ; Tue, 19 Jan 2021 20:12:10 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id h16so24129776edt.7 for ; Tue, 19 Jan 2021 20:12:10 -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:content-transfer-encoding; bh=l9avflWFeErte6PCdfopkFmndIBocFK+Q/nYZfMSQqE=; b=C8X9zRKkt17O637vlA0w7Ei2ZWLSxfOvwrDoOnZpbpLWanHhida3po4heO9YLgkL3h g2rrWM4q75sYgbOcuT7R8Ysq6PNPhyXKwYCrjVwhODO9wH7K/Gp58yjltLJy8hTUDhcW mhLTWMHNIL7Yw9j/eKbhiPuLvflwpUv1jEhGT8drp9zHGpHcuTWMTzmgCQdBAjeu4ehj JlUn/H9Jv4OVBsFlsxG5It9Y90VjsRyGEnCvK8hN94PMvlxdcocSL8tIcgPUxTKL+uPo 8Cvia917hnJtJNAsi9qYcfBvhbbNHwORUEA86Z5/h++2U2xB5oXsd4p+RLPy9O13E7J3 CPVw== 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:content-transfer-encoding; bh=l9avflWFeErte6PCdfopkFmndIBocFK+Q/nYZfMSQqE=; b=EpHx6Jl4LDEpY1Ayt1CP/CKmwbeGrKrPLSUD4L1NRCklK5IitPpPat6aClETfB7b8c SfIwqm9HU6mLByCFstQ54x/b7WB/FEYDBnpy91MgUyJjLVbWz2m0LkfoUkxSpiCltirF EGQFQJgpkVD17IKGIg3Rw2Au/eP9ENExTFhAon4Q/znLw+/suUGE3IwU2xAJ5S6EUUaG ncY3qNlL9fG/5WStKDOtXw5xtErOTPFZsvrsRybtZI445UMS5LtVZpTkUg10xjzU2d2P aw6uK/gF017YYAkgS/57I6YfK7Ak3CNE3bFhc6gBtXbY3d4kEo9K71WD8rH4sNtp0UJB 16pQ== X-Gm-Message-State: AOAM5325FbcrxOscdFc1iWzBYpF2F2kVH6UBDAJnVhjnVfSRumfuaJkA 9UF813z15LpgjKqyGlofLDRvRhjST9KI4d0Z4/Pv2g== X-Received: by 2002:a05:6402:5107:: with SMTP id m7mr3750536edd.52.1611115929077; Tue, 19 Jan 2021 20:12:09 -0800 (PST) MIME-Version: 1.0 References: <20210119213727.pkiuSGW9i%akpm@linux-foundation.org> <5f8e2ede-5836-45e1-d8d7-ae949775e76e@infradead.org> In-Reply-To: <5f8e2ede-5836-45e1-d8d7-ae949775e76e@infradead.org> From: Dan Williams Date: Tue, 19 Jan 2021 20:12:01 -0800 Message-ID: Subject: Re: [PATCH -mmotm] mm/memory_hotplug: fix for CONFIG_ZONE_DEVICE not enabled To: Randy Dunlap Cc: Andrew Morton , Mark Brown , linux-fsdevel , Linux Kernel Mailing List , Linux MM , Linux-Next Mailing List , Michal Hocko , mm-commits@vger.kernel.org, Stephen Rothwell Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 19, 2021 at 7:05 PM Randy Dunlap wrote: > > From: Randy Dunlap > > Fix memory_hotplug.c when CONFIG_ZONE_DEVICE is not enabled. > > Fixes this build error: > > ../mm/memory_hotplug.c: In function =E2=80=98move_pfn_range_to_zone=E2=80= =99: > ../mm/memory_hotplug.c:772:24: error: =E2=80=98ZONE_DEVICE=E2=80=99 undec= lared (first use in this function); did you mean =E2=80=98ZONE_MOVABLE=E2= =80=99? > if (zone_idx(zone) =3D=3D ZONE_DEVICE) { Thanks Randy. Apologies for the thrash, obviously the kbuild-robot does not include a CONFIG_ZONE_DEVICE=3Dn. I'd prefer to fix this without adding ifdefery in a .c file with something like this: 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) =3D=3D 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) =3D=3D 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))