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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 6EDEEC433E0 for ; Thu, 21 Jan 2021 02:50:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DCDC72388E for ; Thu, 21 Jan 2021 02:50:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCDC72388E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 345B76B0008; Wed, 20 Jan 2021 21:50:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F5BA6B000A; Wed, 20 Jan 2021 21:50:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20C496B000C; Wed, 20 Jan 2021 21:50:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id 0A8576B0008 for ; Wed, 20 Jan 2021 21:50:39 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C6491181AEF39 for ; Thu, 21 Jan 2021 02:50:38 +0000 (UTC) X-FDA: 77728254156.11.stove83_5c0c7882755f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id A365B180F8B82 for ; Thu, 21 Jan 2021 02:50:38 +0000 (UTC) X-HE-Tag: stove83_5c0c7882755f X-Filterd-Recvd-Size: 3500 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Thu, 21 Jan 2021 02:50:37 +0000 (UTC) Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4DLn0k2LSsz15wTp; Thu, 21 Jan 2021 10:49:26 +0800 (CST) Received: from [10.174.177.2] (10.174.177.2) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Thu, 21 Jan 2021 10:50:31 +0800 Subject: Re: [PATCH] mm: Fix ZONE_DEVICE usage in move_pfn_range_to_zone() To: Dan Williams CC: Randy Dunlap , , , Andrew Morton References: <161111619868.2787408.1710192276369197040.stgit@dwillia2-desk3.amr.corp.intel.com> From: Miaohe Lin Message-ID: <176cc797-7aab-58f5-baee-66a62081f953@huawei.com> Date: Thu, 21 Jan 2021 10:50:31 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <161111619868.2787408.1710192276369197040.stgit@dwillia2-desk3.amr.corp.intel.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.2] X-CFilter-Loop: Reflected 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 2021/1/20 12:16, Dan Williams wrote: > 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)) > > > . > Reviewed-by: Miaohe Lin