Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2201947pxb; Thu, 3 Feb 2022 01:20:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMTPOgiyJH4ItHcBuFibBvz9G9ntquYgXF/5z3rKCFOLBeOBd88HWu2BP7BJz8rp5XItqH X-Received: by 2002:a17:902:ecd1:: with SMTP id a17mr35071615plh.28.1643880002089; Thu, 03 Feb 2022 01:20:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643880002; cv=none; d=google.com; s=arc-20160816; b=QSp2Ei9Vw2+f3wOd67H5kdZM5uUwGJRKOvn0e8ShaH8lk1AKeq9mbuZKSGvH5sLgOK 9da9Bkt4kUju2VT0b84fT1Vk+Rd1LEBwfart7Lj6doMtp2bG0JOlnUk2r1IcGkHNVoE0 6CS77Oc3sU/X63J5WGx0TQL6jgHo9JGptMKB4XLcAhVehiRwiDpcwXRWY85GbPs8MAcf 7TrRWIUlWOcATlQPW/hXTruDWIK3lC5fuVmAGy0qN8oClxLob2C0E7t8ZNKYiv7bqPVW D+Nb7YN8d1Nvv2uNuUVnwzxbAT4W3lLqE85U2DoyJ3YPuxWzPpYaa7uSLmCgDEmhIgmy yyfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=lxWBwGKgTWaFZT5siy9MmYF0wpXs3bDIfO+VSmkVhOs=; b=EwSltkrhvYVBgnMQ1mkhuF7DfDxq4W/As9uBSAtPZUjSfKZEoSfPmanuxSkJP3O0MQ EOD8q/VvoJkPv/U42yp+hbi52/2pXI9xQ6FHvKP5grHp4WCHOngoo9OdbRg0wDc6qFuA 6EQ+9AIaed9+FBREccUGi9+LzTZugXv1aaFb1EdhiOZWQWWYekPF9QytjmVm67M9IlHb U2Cs4tGWyRM2TlpsjH9/sYbL/kXzU8ioDr238AC2Zv2TgzBvCjAMarHWVp38vPBG2f7F O/J8gzQxD7mN7BnCIElY52bLwLhlQ2DIvtwvdQgFOVm5dNVAzAHeC1nnnmmb9xE567Tr KFcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VrvDepaP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n2si21329751pgu.793.2022.02.03.01.19.50; Thu, 03 Feb 2022 01:20:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VrvDepaP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238494AbiBCCAd (ORCPT + 99 others); Wed, 2 Feb 2022 21:00:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229640AbiBCCAc (ORCPT ); Wed, 2 Feb 2022 21:00:32 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A927C061714 for ; Wed, 2 Feb 2022 18:00:32 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id jx6so3410381ejb.0 for ; Wed, 02 Feb 2022 18:00:32 -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=lxWBwGKgTWaFZT5siy9MmYF0wpXs3bDIfO+VSmkVhOs=; b=VrvDepaPiHZBFur4A33iJd7uY8YvKRz8K13whFn26G2dh3BG1TB1GYdcf4fivbkGM+ FhAZ9/s8ZI3gSAug+BEPoRid87hyp1BFgDfwqFASb80T9nG180nndYiQ/JsQ8f7ThMlf 2EOuSaRUI1q/wqV5PFXKWQnyt9NfSRvM8YuSzzgM/xrXsAi4WQqWmUxHXrmmsHBqimJ9 GzGQfT7B4m1bfBCuXYu9Q4VApQ7mRu5gXgbwvKEjT7X4CXLavN0xx7f1LKqYaWaFtWGz KpSiNQKz2MoVBo9+81J5QxFkLHOnPvKMHZL5hoh336V5VfvFwt2cEPdKBspMsQ9fVhux XYDg== 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=lxWBwGKgTWaFZT5siy9MmYF0wpXs3bDIfO+VSmkVhOs=; b=HbaNoGfxSpZmY1k2SW7sOJByQr3ZsN36El/VV2s1cfVc9Mzgq5gzHpQT8n8Qjppcl8 i3qkF6b0pzYyPdz4fBg1ddoE4Po1OAM4/vk3Kl8xIi0yzYPtWx5A29/1BjTpk2GcWLDH njQkaSOH3pSFv/PASHT0S38g4rGMKvCAR/6fzlLqpJWbSb2c2HSfkWUlIiQKxAjcD7Xe p1Va+e4FWvTmMG0qR1SD4dvR0WezCjQSYHevveASdRq2N5cW2H/mfpLpZxPHy4H6mT6A F27ul2qqvmsGKsxWBbYJYnWqfDI3qy9baEMQUkleM+Qp1ijRVoEDmR9JWGqNlQ7rhes6 R1dw== X-Gm-Message-State: AOAM531Awu5MTyInh+JgxDMNz1NE6g4aFisXUDrl9lCOKFrJl7InMrAD Zkeuc1W0/mM+/O09rqduQ1c= X-Received: by 2002:a17:907:c20:: with SMTP id ga32mr27273669ejc.638.1643853630831; Wed, 02 Feb 2022 18:00:30 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id rv28sm15884487ejb.71.2022.02.02.18.00.30 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 Feb 2022 18:00:30 -0800 (PST) From: Wei Yang To: akpm@linux-foundation.org, mhocko@suse.com, mgorman@techsingularity.net Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wei Yang , David Hildenbrand Subject: [PATCH] mm/page_alloc: add zone to zonelist if populated Date: Thu, 3 Feb 2022 02:00:22 +0000 Message-Id: <20220203020022.3044-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org During memory hotplug, when online/offline a zone, we need to rebuild the zonelist for all nodes. Current behavior would lose a valid zone in zonelist since only pick up managed_zone. There are two cases for a zone with memory but still !managed. * all pages were allocated via memblock * all pages were taken by ballooning / virtio-mem This state maybe temporary, since both of them may release some memory. Then it end up with a managed zone not in zonelist. This is introduced in 'commit 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with pages managed by the buddy allocator")'. This patch restore the behavior. Signed-off-by: Wei Yang CC: Mel Gorman CC: David Hildenbrand Fixes: 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with pages managed by the buddy allocator") --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index de15021a2887..b433a57ee76f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6092,7 +6092,7 @@ static int build_zonerefs_node(pg_data_t *pgdat, struct zoneref *zonerefs) do { zone_type--; zone = pgdat->node_zones + zone_type; - if (managed_zone(zone)) { + if (populated_zone(zone)) { zoneref_set_zone(zone, &zonerefs[nr_zones++]); check_highest_zone(zone_type); } -- 2.33.1