Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5513874rwd; Mon, 12 Jun 2023 06:16:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7x6QyblZvyOvhy/KblcQupZU9bQDp4r/fl2V0biAm/UEyhY17AyMdn8ma4clGktPvfh67N X-Received: by 2002:a17:907:318e:b0:978:6a95:512d with SMTP id xe14-20020a170907318e00b009786a95512dmr9274253ejb.11.1686575793525; Mon, 12 Jun 2023 06:16:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686575793; cv=none; d=google.com; s=arc-20160816; b=Dv6BIrsu7HLGdm1nSyz/bTB8fImJMXKNe5fA41Ip3OZz223bRoq13zobr5BrjSsm2f G/Pdjh7lY87Kv0vi97XEpe4nvAX3tbSPevUfBY9GtHp2fsQdTDYiEkvGSpA2JwgsuqYf /ZvUQUvMp2xwg7U3GfSkKZX/U+26AxyUFL9BbHwTDflKhCn0+rwMtF7u5rLaY2nu8kxT Dv1Ckc93qWJBXppDCWHY4ds4KtOdJ9wIxAK/H8bGHp4YhCPT6yZM0EhmXYtQRAOFV7rM qIpy1uj0hjua6Bn6bPQqXTFFCdfxZiwrdug4n4W+cEkVkkn/DvYCB9Dsje2y+QlnzEHS z/rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=D0Ct9Pf6HNaO943RqT6wE4phESLehl9Ykd997P4yTg8=; b=cMjP2DhR6DYUKdyW2MKtfAzy6uZ85fi/lAuk+X6DVp1MYNcgnFRGYMzS3F7ELQuqUw 8iwHU7pHIviAGjiPKDSQYLhH/dNdNXfsQJ80EmG2bfMo487nFi33fAks1du7aelMpOLM /zxJsIzyiuUGJy9njDSOEMn2v/6yyZkgB90d1UEqoIZxE6eJwOuTogam2yFLVvQ2PTtP 3as3VdsLCeTGhhAEA7xzdKB1SxywmPJ6kZzDy9h8QrmY3DCKqPHF9Mk0hkgWf8FtoP9c fUPCC5oggjnB47CZtfM3rWTFUDbqf5rpKfu76g+N65wKPVnOcVZcQ/Z96UZYuEzKe877 p3jg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o7-20020a17090608c700b0096a411a1cf9si4863152eje.940.2023.06.12.06.16.03; Mon, 12 Jun 2023 06:16:33 -0700 (PDT) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235411AbjFLMvO (ORCPT + 99 others); Mon, 12 Jun 2023 08:51:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235386AbjFLMvM (ORCPT ); Mon, 12 Jun 2023 08:51:12 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABE8AE52 for ; Mon, 12 Jun 2023 05:51:10 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Qfs0z6s95zLq6v; Mon, 12 Jun 2023 20:48:03 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 12 Jun 2023 20:51:07 +0800 From: Peng Zhang To: , , , CC: , , ZhangPeng Subject: [PATCH] memblock: use the helper macro for_each_zone Date: Mon, 12 Jun 2023 20:51:02 +0800 Message-ID: <20230612125102.1674568-1-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: ZhangPeng Let's use the helper macro for_each_zone to iterate over all memory zones and reset the node managed pages. After that, we can remove the unused function reset_node_managed_pages. Signed-off-by: ZhangPeng --- mm/memblock.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/mm/memblock.c b/mm/memblock.c index da4264528e1e..af552604c3fb 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2122,23 +2122,15 @@ static unsigned long __init free_low_memory_core_early(void) static int reset_managed_pages_done __initdata; -static void __init reset_node_managed_pages(pg_data_t *pgdat) -{ - struct zone *z; - - for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++) - atomic_long_set(&z->managed_pages, 0); -} - void __init reset_all_zones_managed_pages(void) { - struct pglist_data *pgdat; + struct zone *z; if (reset_managed_pages_done) return; - for_each_online_pgdat(pgdat) - reset_node_managed_pages(pgdat); + for_each_zone(z) + atomic_long_set(&z->managed_pages, 0); reset_managed_pages_done = 1; } -- 2.25.1