Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp6095368pxb; Thu, 27 Jan 2022 06:27:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyhhSvl+GSZlCgOeDfCWLWQRK77Z+STPCAlru9PkP8T9FABZcG6rfjsAmPgQ/VyJ5SeuHeg X-Received: by 2002:a17:907:728e:: with SMTP id dt14mr3174847ejc.491.1643293655696; Thu, 27 Jan 2022 06:27:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643293655; cv=none; d=google.com; s=arc-20160816; b=qmEkM7PnyctRZA3CyBc8zEcGXdEhtHDW06SyqE/Z+XABMbUIqvv6q7P1B6razdAH0/ YajyNMrMVzGhFsGuC7ynSFEhleJZNbmjL9mXir68RZvAZmn7wbAVGBXteE1wOHQVNIuf a8ObuqsYqLmiaGasXhQEl2xpKgX1Lg8ilKxYJd6jbCTmUU+GBRcDHFoHHvnwZtJm7DCS 8OdUpbFWZwSSGiiDfl0Aq0qvmirp7cEhR/jGFnCdhHzfWxevBxohrw6ta0b4c0kIkJjP NcgcQPiMJIZNXn2xL80qzaNYGOpF2CPBGA0/7bdDZRxuX3UbuW4vUQ4/GBVWlCD0wzED P0ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GKwmHasx6cNIOtEqFZmKX8VIkRB0CJ5THiVwoA6l1Yo=; b=Y0+BcO//dZK1UJKiT/3VHXhnotk8koAsyWWK5u89P3Qf47lw9vqMe6rQKcKQtnK+8y CTX+fYWdwuX1pwU4KgzKahZwHg8s6MxZ8E2n6bDPYM4/ZnwBlYcoMW6/dcsPZKmsuERD w6mPdUUYIO2CdKZH1HiErMaRkn8ZPVGEl2d0MadlGKGHbg66ZlnrcUjVWgifM5ayonxq B5svSn0erz7Stjpejao5c0tt50sv5elKJdWDfKz2hXcJqmUrduBM75fLVo29uOFk9ROr DrEI9+eYBo4GCWKlnqg5xpFkwng/Z4Ig0fv0gdOEM468wwTj4sYEbrgXXMjbM5NslsTm h3xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=L37K3Yi1; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y12si1712104edd.181.2022.01.27.06.27.10; Thu, 27 Jan 2022 06:27:35 -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=@suse.com header.s=susede1 header.b=L37K3Yi1; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237771AbiA0I2Z (ORCPT + 99 others); Thu, 27 Jan 2022 03:28:25 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:44980 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230518AbiA0I2V (ORCPT ); Thu, 27 Jan 2022 03:28:21 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 5C0B021904; Thu, 27 Jan 2022 08:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1643272099; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GKwmHasx6cNIOtEqFZmKX8VIkRB0CJ5THiVwoA6l1Yo=; b=L37K3Yi1xWUmPAahnJRKqSepNwFhR0VVQ6OgN7TE06U16NG0rkOsOkvSuVip8k+NuH3yiX VXKR64l+Y15lW+8PCoQfffKjRxtBdX0RRse/QNYhRkmhwk/vXzVZ47m9eYNBonaQDT0R62 Mm/GrnMWevJY2DRCtNHnsdXjy8ElbvM= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id D11E4A3B8B; Thu, 27 Jan 2022 08:28:17 +0000 (UTC) Date: Thu, 27 Jan 2022 09:28:17 +0100 From: Michal Hocko To: Wei Yang Cc: akpm@linux-foundation.org, mgorman@techsingularity.net, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/memory_hotplug: build zonelist for managed_zone Message-ID: References: <20220127012023.18095-1-richard.weiyang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220127012023.18095-1-richard.weiyang@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 27-01-22 01:20:23, Wei Yang wrote: > During memory hotplug, when online/offline a zone, we need to rebuild > the zonelist for all node. There are two checks to decide whether a zone > would be added to zonelist: > > * one in online_pages/offline_pages to decide necessity > * one in build_zonerefs_node to do real add > > Currently we use different criteria at these two places, which is > different from the original behavior. > > Originally during memory hotplug, zonelist is re-built when zone hasn't > been populated. This in introduced in 'commit 6811378e7d8b ("[PATCH] > wait_table and zonelist initializing for memory hotadd: update zonelists")'. > And at that moment, build_zonelists_node() also use populated_zone() to > decide whether the zone should be added to zonelist. > > While in 'commit 6aa303defb74 ("mm, vmscan: only allocate and reclaim > from zones with pages managed by the buddy allocator")', > build_zonelists_node() changed to use managed_zone() to add zonelist. > But we still use populated_zone() to decide the necessity. > > This patch restore the original behavior by using the same criteria to > add a zone in zonelist during memory hotplug. Why? > Signed-off-by: Wei Yang > Fixes: 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with pages managed by the buddy allocator") > CC: Mel Gorman > --- > mm/memory_hotplug.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index 2a9627dc784c..8f1906b33937 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -1102,11 +1102,11 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, > spin_unlock_irqrestore(&zone->lock, flags); > > /* > - * If this zone is not populated, then it is not in zonelist. > + * If this zone is not managed, then it is not in zonelist. > * This means the page allocator ignores this zone. > * So, zonelist must be updated after online. > */ > - if (!populated_zone(zone)) { > + if (!managed_zone(zone)) { > need_zonelists_rebuild = 1; > setup_zone_pageset(zone); > } > @@ -1985,7 +1985,7 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages, > /* reinitialise watermarks and update pcp limits */ > init_per_zone_wmark_min(); > > - if (!populated_zone(zone)) { > + if (!managed_zone(zone)) { > zone_pcp_reset(zone); > build_all_zonelists(NULL); > } > -- > 2.33.1 -- Michal Hocko SUSE Labs