From: David Hildenbrand <david@redhat.com>
To: Haifeng Xu <haifeng.xu@shopee.com>
Cc: osalvador@suse.de, rppt@kernel.org, mhocko@kernel.org,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mm/mm_init.c: remove reset_node_present_pages()
Date: Fri, 2 Jun 2023 13:56:13 +0200 [thread overview]
Message-ID: <d92273f6-28be-dc37-3ca5-a9579a75f8c4@redhat.com> (raw)
In-Reply-To: <20230601162626.1030-2-haifeng.xu@shopee.com>
On 01.06.23 18:26, Haifeng Xu wrote:
> reset_node_present_pages() only get called in hotadd_init_pgdat(), move
> the action that clear present pages to free_area_init_core_hotplug(), so
> the helper can be removed.
>
> Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
> ---
[...]
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index 78e67041ae9f..e24ea1db9e26 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -1491,6 +1491,7 @@ void __ref free_area_init_core_hotplug(struct pglist_data *pgdat)
> {
> int nid = pgdat->node_id;
> enum zone_type z;
> + struct zone *zone;
You can declare that within the for loop.
> int cpu;
>
> pgdat_init_internals(pgdat);
> @@ -1507,6 +1508,8 @@ void __ref free_area_init_core_hotplug(struct pglist_data *pgdat)
> pgdat->kswapd_order = 0;
> pgdat->kswapd_highest_zoneidx = 0;
> pgdat->node_start_pfn = 0;
> + pgdat->node_present_pages = 0;
> +
> for_each_online_cpu(cpu) {
> struct per_cpu_nodestat *p;
>
> @@ -1514,8 +1517,15 @@ void __ref free_area_init_core_hotplug(struct pglist_data *pgdat)
> memset(p, 0, sizeof(*p));
> }
>
> - for (z = 0; z < MAX_NR_ZONES; z++)
> - zone_init_internals(&pgdat->node_zones[z], z, nid, 0);
> + /* When memory is hot-added, all the memory is in offline state. So
/*
* When ...
> + * clear all zones' present_pages and managed_pages because they will
> + * be updated in online_pages() and offline_pages().
> + */
> + for (z = 0; z < MAX_NR_ZONES; z++) {
> + zone = &pgdat->node_zones[z];
Too bad we don't have something like node_zone(pgdat, z)
Might be a reasonable cleanup staring at "git grep "pgdat->node_zones""
output ...
> + zone->present_pages = 0;
> + zone_init_internals(zone, z, nid, 0);
> + }
> }
> #endif
>
In general,
Acked-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2023-06-02 11:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 16:26 Haifeng Xu
2023-06-02 11:56 ` David Hildenbrand [this message]
2023-06-07 2:50 ` [PATCH v2 " Haifeng Xu
2023-06-07 10:33 ` Michal Hocko
2023-06-07 11:38 ` David Hildenbrand
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=d92273f6-28be-dc37-3ca5-a9579a75f8c4@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=haifeng.xu@shopee.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=osalvador@suse.de \
--cc=rppt@kernel.org \
/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
all inboxes | Powered by JetHome®