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=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 81FEDC433E9 for ; Wed, 20 Jan 2021 04:19:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 527122312B for ; Wed, 20 Jan 2021 04:19:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728729AbhATETp (ORCPT ); Tue, 19 Jan 2021 23:19:45 -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-Google-Smtp-Source: ABdhPJxaTZmcMRWRWf1kOl8EoB4XcBiaPjcSic8IErTq56RdAQHmLAtfGaZyRwaI/gCzOTN5YYo0k2RdctfiDacqV4Y= 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)) 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=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 4F5F5C433E0 for ; Wed, 20 Jan 2021 04:12:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CB5382312D for ; Wed, 20 Jan 2021 04:12:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB5382312D 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 1783F6B0005; Tue, 19 Jan 2021 23:12:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 12A276B0006; Tue, 19 Jan 2021 23:12:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 065B56B0007; Tue, 19 Jan 2021 23:12:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0222.hostedemail.com [216.40.44.222]) by kanga.kvack.org (Postfix) with ESMTP id E4F3C6B0005 for ; Tue, 19 Jan 2021 23:12:11 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B049F8249980 for ; Wed, 20 Jan 2021 04:12:11 +0000 (UTC) X-FDA: 77724830862.07.egg88_550fe4327557 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 99AF51802EF2F for ; Wed, 20 Jan 2021 04:12:11 +0000 (UTC) X-HE-Tag: egg88_550fe4327557 X-Filterd-Recvd-Size: 5197 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 Jan 2021 04:12:10 +0000 (UTC) Received: by mail-ed1-f42.google.com with SMTP id g1so23476358edu.4 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=tCKlsae5H10FLWfnY+Be6+sfpVqbKk6XwOSvXnWcYi1Z+WRPQN7INctblAvuMuaRnL A/B2LRoIK8XOKd4t83YuN6QpN6oP06fJQGmIOEmhaodInSCcjtJ59UYuTxfW+AMYub/5 0gtB8PealtQ8ZVkl5TyL1WH0R0GmJiIcGhgFAK7ii5TXJXa1Zs1JTOsnHS+i56Ca3noS PhnXB41PM4xoK4JUdT4e8r2VqIxi9OPUHvMwpGXqx8FvKG/7RCr6NcVmw4nl1PGTGKWp 7BCkRUcFPxJfsaqHnL5PKl3LqMNczfsOQlEUCzechigfmWw8Ljhpg3sil/TeQpReTAQR fD8w== X-Gm-Message-State: AOAM532dC50pswZX8KpjSehXHxKBo+lPorSuV5yo5i32MS0O7EH8xv2R 7L+W4TuXGLZIa40+iD78HQhZlbgzoZukFeC7w8vtbQ== X-Google-Smtp-Source: ABdhPJxaTZmcMRWRWf1kOl8EoB4XcBiaPjcSic8IErTq56RdAQHmLAtfGaZyRwaI/gCzOTN5YYo0k2RdctfiDacqV4Y= 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 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 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))