From patchwork Mon Jun 12 12:51:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13276462 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 67BB3C7EE23 for ; Mon, 12 Jun 2023 12:51:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9697D6B0072; Mon, 12 Jun 2023 08:51:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 919FE8E0003; Mon, 12 Jun 2023 08:51:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 808568E0002; Mon, 12 Jun 2023 08:51:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 704B36B0072 for ; Mon, 12 Jun 2023 08:51:17 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 27913AF488 for ; Mon, 12 Jun 2023 12:51:17 +0000 (UTC) X-FDA: 80894081394.02.92EE822 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf22.hostedemail.com (Postfix) with ESMTP id BABF5C0026 for ; Mon, 12 Jun 2023 12:51:13 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686574274; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=D0Ct9Pf6HNaO943RqT6wE4phESLehl9Ykd997P4yTg8=; b=ZWKnVXXjFx/AiNiawIFETyZ/g/1MgyK/jKtSAgRSlMTSbOET0SLa+VGpulU6vFhbncPizm qeD1RJAqFJSB7YSrsFn9x9twSKUoeQUvwCkRW2cIEGIQrGkYe3BksCdqHdjNBXKVnscQSJ 3jvLVovGEpzbhT6be68IX2OjWNqMt7s= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686574274; a=rsa-sha256; cv=none; b=eFJiXmKjVKcTnN3QIOlmOXDFGa7+Np3Ba26UZCbW1vz1VHpG3XbDdiWXAZftHhuOT+zmTi RXLaah35diZqlPzklQZMcKG+Qc4N8hM/+bKdrhYLVBdI3LmAGJEvvNPd5yOjuZGn8CY+S5 j6O9PLEhbL3sLQ6U17VrTwrDW6duQOY= 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 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-Rspamd-Queue-Id: BABF5C0026 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: ouoqfkiwiekzyqfyfsh17ibzc1ppnns4 X-HE-Tag: 1686574273-511060 X-HE-Meta: U2FsdGVkX18xVDECKEVeHx1twVcMdPjSmffVMYYsD2mNgb9QW0x8jpqSQ9pmjhLNBw3heX8StdagOeiqs3csMBwhPxZ1v3vI58TZMos/X6OiXDa2wyOsD7YjNmaxE9f2Sn1GvQ+EqqKo1xCHbmOngWPgikFMYJR6uzSFIQln+lZTaX1pH2MclUQ3cz7undj+d1z5hu2+2S7YUIAk3MSwy9qMNB4lnJHz3+C2RHJhhy9WAPZQx7DnDZ78q+SYmtCVX6JKlYrO48cqtx0GM3Pjlcrus4jPmDwlwjNdVF2TELGDJGD3H4iwikvBqL5O4wFKD3/q8xEbopTZxtiOY5vHvkSOHEKkK2rB+qiz3BA7e5Q3obQOxnjYx6cytgkhR4WLBWc2OOkJNamhQMp7BYNvSpP/YKqucY0iUTZPAcX7c4Ld4vDpad29853I96MbrVn7cDvumRVNtd5dBITGDcnkE9CyZV42RJM8fjENgRUWBlOYbkSCyz/BpgdNC0FPImgcw0emPUJOKZKjeH74035qkuIwgupAywZeqoEelJdiilcYq2nTtj5mCOG4o8IJcciqWVm6kF9fH2a8ZbfgQf2Y2Z5tMCc6pNeUUTOLIlP0SCb0PANZXhvsm0rTpvPPasi0Re/mwfeicGZFBaw4EOh9yb2tlcmNM79ef1yHroayYlZ0Wg/R5t5A0QJ5JfmREjzju862BAI6kACzKulLoDho8eA7htRcBpXvdRbxlcS3tdfsRHSfd48ZjlgDx/q0+FFAAj2t2EFKbEYeaQ2GMdAM6mLXmaFHX4M7DwaW54CoE5L0V7B1YJu5r8hekDVDGBRWjJoeNtsqn6fl0YhojKUCn3Vuqb/7uQa63Ysgslf87gZ3qfdHXrYm9zvYhaJxWmILVSrV+0AFmT5pSI29PyqgM0g/JCTc7i1McSJypzFc+JY/TgssUexFBDye4B4eO634T51WT1xkHK6IMQK7B62 5cwf8UIb ZtCxCWVtE+ZZdnJ4h0w/Z/VV1lQWjdpHX0mTc9GM8fu5uEG1DkkoS587pHuS2+D4jrePyYrgvrZrrctRJ7IcXtGTyI8cm4zHeXj+UU1KnYz0iR+tXo7u66ty7/2NOqg8YaMGbJ+aBEkaSiF9IWwGKIyV5N9wkblrq/d0E32ojORr805XjUwYZ4A86pJsrmYS+vnLY X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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; }