linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peng Zhang <zhangpeng362@huawei.com>
To: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	<rppt@kernel.org>, <akpm@linux-foundation.org>
Cc: <wangkefeng.wang@huawei.com>, <sunnanyong@huawei.com>,
	ZhangPeng <zhangpeng362@huawei.com>
Subject: [PATCH] memblock: use the helper macro for_each_zone
Date: Mon, 12 Jun 2023 20:51:02 +0800	[thread overview]
Message-ID: <20230612125102.1674568-1-zhangpeng362@huawei.com> (raw)

From: ZhangPeng <zhangpeng362@huawei.com>

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 <zhangpeng362@huawei.com>
---
 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



             reply	other threads:[~2023-06-12 12:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 12:51 Peng Zhang [this message]
2023-06-14 11:46 ` Mike Rapoport
2023-06-15  9:22   ` zhangpeng (AS)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230612125102.1674568-1-zhangpeng362@huawei.com \
    --to=zhangpeng362@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@kernel.org \
    --cc=sunnanyong@huawei.com \
    --cc=wangkefeng.wang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox