Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp710760pxb; Wed, 20 Jan 2021 19:32:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJd6G25c1iGdjcWvUdW8Sxsc5gEEskx3dWmGBUHVAmMkufjE+bPAKWwsWktxqHY3iMJvYB X-Received: by 2002:a17:906:26d7:: with SMTP id u23mr7767534ejc.210.1611199946004; Wed, 20 Jan 2021 19:32:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611199945; cv=none; d=google.com; s=arc-20160816; b=ZEIbk6C1pjwkE5X74aDp2PSEpWZ6fYtqpBsFjwoOzVyTpeSbsTcTtmIvZ9KPhoyaYt lnO3idKBhOmvjqVdSnW+hv0suA1IzAwmxgyzEQBhJKj7VdwBHLjTUG9JZzAqfypZNzEG Rd2vUKTjguGn3KT0881c+CeAT62dpmkAdVC9D23lqAkNLkawtJuWyXg2pyqLBHuuU3aJ sKHMT/RjOrny+9fuT6amuqpCfoYWlA9Hm6yM6ZpdsHlpU4OOHCf98leJYzfLx42c67Q1 r8bMsdDVcPoaR7KUQivxepd0GqTRkNoiHOSuGxzculOFYb02P447LcAYZBY54NqtSUFa H6xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=xlK40CQ0XitKARvHo5myKCK6OL+HOmGu3nbO01gI8D4=; b=ydCjcx1/UYGDRED/5jq07jfqWuX4EIHOwT9JJPB65ncFuqZvfdc7ftG+E/2JNlnm9f i1qkWDCR51lqA2nv+UHXu/pSm0VhFZk/PRPhRb7/G6Fen8PAhJWaOHBfXuOSFoSbSSVc 0RxVv3vJXFBQ98l+CWfE4IW0cfe2sy7w3v+MTVeVNdbzk6gXJlgcCqYvOlGOvB88erjg ZtGR7NK3nmPeJGpfFnDRUZvyu17KYbipEBqbWcTq/JbSPUd04D/AH3h5g7CTrg7xjS3i Or21h4zuqybXjpxAsaiFGV8aBTfmvVk7vCc+40re7iLRQ4VJXyhJkgpmG5n8z+XKlWTU 8XBQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gt31si1295120ejc.155.2021.01.20.19.32.02; Wed, 20 Jan 2021 19:32:25 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726438AbhAUDCn (ORCPT + 99 others); Wed, 20 Jan 2021 22:02:43 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:11116 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393200AbhAUCvQ (ORCPT ); Wed, 20 Jan 2021 21:51:16 -0500 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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