From patchwork Thu Jan 27 01:20:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 12726049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAE3CC433F5 for ; Thu, 27 Jan 2022 01:20:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2917F6B0071; Wed, 26 Jan 2022 20:20:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 241506B0072; Wed, 26 Jan 2022 20:20:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1099E6B0073; Wed, 26 Jan 2022 20:20:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0188.hostedemail.com [216.40.44.188]) by kanga.kvack.org (Postfix) with ESMTP id 025FC6B0071 for ; Wed, 26 Jan 2022 20:20:37 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A9C7A944E4 for ; Thu, 27 Jan 2022 01:20:37 +0000 (UTC) X-FDA: 79074312114.06.DC3CB42 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by imf06.hostedemail.com (Postfix) with ESMTP id F3375180006 for ; Thu, 27 Jan 2022 01:20:36 +0000 (UTC) Received: by mail-ed1-f42.google.com with SMTP id j2so1497577edj.8 for ; Wed, 26 Jan 2022 17:20:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=elzTyLMca2pvBYgTWQkNCYxxJD3xd3Z07gwcpc0mZtg=; b=KhzTbfhlLCq7WoRZGIlVP2DWwdbNn8huwiVIEymR5ot3XAei7DWDavfibE2uqvBynt VwAblbIyC1TAAY7NNPiWWIswT6tpHI/p20XwfTFb2NSk2X9tCFKTbmCA/9jiRAJsDSpx 5noVlLG5D3zSE6TuKW2YgDDm2p+WK2gn3rYd4wyl6X1byv8HT8noGwmQXStOFfusghyC Mi5I9Hsgasbhq4ryOk5ZP1+blHerBXCGMirm5iFwV/a928QkHwhXs+JZ1nBwH7bZMKy8 aGLMwVG30fPujmctdeq1UblZKed22fC42zl5bdDVA9cT0bXqS0sEYLgFOIJ67LzBBEcS rXRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=elzTyLMca2pvBYgTWQkNCYxxJD3xd3Z07gwcpc0mZtg=; b=OheTmYvjje3DkGhXaRZxq1Sh5KFyNaFc8mXRo8HhOWFwG2ie8JDX1fTuR4zNHy7Ajz zCq32RnSRmRP5bqplRDYGI5fzH9JtM8D+ntkfToWGVKD0eUnrBMS8v7rPnGojBWcUNPe 2XeBPX0EMBZKO2VP8jL0gz61K3nCMU/sshvCQSCwQHR9ueHSpAvFnUDDp051DbEK0zBx q908QEVPlQV/sjwNJ9yzjpKbBOU4kizQfxAtsH8j93zR+5yzRCMGdgo2tkpZxm6vKDli dvID6xLGmWys3LzjPuPQmOONX8OV7UjU/si90DImxgWCNzkJp6iwciLS4VJNvJs9l+JY nw3w== X-Gm-Message-State: AOAM530S88MpBz2o15/zGlvCOgcQ/3SBipKoWoZa39euSjFhkRBtuu24 AWiPfK6cOQ2wOU43d/eFkKU= X-Google-Smtp-Source: ABdhPJxei5y/VVo7zaV2Lm4x0kqN1JeLqWTk6B3KNkWX512WC3+wql8dOVc78jaL5emQGyaPdU5ZBQ== X-Received: by 2002:a05:6402:11c7:: with SMTP id j7mr1485069edw.139.1643246435430; Wed, 26 Jan 2022 17:20:35 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id by22sm8057957ejb.84.2022.01.26.17.20.34 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Jan 2022 17:20:35 -0800 (PST) From: Wei Yang To: akpm@linux-foundation.org, mgorman@techsingularity.net, mhocko@suse.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wei Yang Subject: [PATCH] mm/memory_hotplug: build zonelist for managed_zone Date: Thu, 27 Jan 2022 01:20:23 +0000 Message-Id: <20220127012023.18095-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: F3375180006 X-Stat-Signature: bfwr3a7u74ijs5ptrb9jfycqog5oxbnx X-Rspam-User: nil Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KhzTbfhl; spf=pass (imf06.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1643246436-680650 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. 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); }