* [PATCH 2/2] mm/mm_init.c: do not calculate memmap and reserved pages for empty zone
@ 2023-06-01 6:35 Haifeng Xu
2023-06-01 16:35 ` Mike Rapoport
0 siblings, 1 reply; 2+ messages in thread
From: Haifeng Xu @ 2023-06-01 6:35 UTC (permalink / raw)
To: rppt; +Cc: mhocko, akpm, linux-mm, linux-kernel, Haifeng Xu
For empty zone, it's unnecessary to account for pages used by memmap.
Also, the pages reserved in dma zone can be ignored.
Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
---
mm/mm_init.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/mm/mm_init.c b/mm/mm_init.c
index 232efac9a929..b82718d596c3 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -1543,6 +1543,13 @@ static void __init free_area_init_core(struct pglist_data *pgdat)
size = zone->spanned_pages;
freesize = zone->present_pages;
+ if (!size) {
+ nr_kernel_pages += 0;
+ nr_all_pages += 0;
+ zone_init_internals(zone, j, nid, 0);
+ continue;
+ }
+
/*
* Adjust freesize so that it accounts for how much memory
* is used by this zone for memmap. This affects the watermark
@@ -1579,10 +1586,6 @@ static void __init free_area_init_core(struct pglist_data *pgdat)
* And all highmem pages will be managed by the buddy system.
*/
zone_init_internals(zone, j, nid, freesize);
-
- if (!size)
- continue;
-
setup_usemap(zone);
init_currently_empty_zone(zone, zone->zone_start_pfn, size);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] mm/mm_init.c: do not calculate memmap and reserved pages for empty zone
2023-06-01 6:35 [PATCH 2/2] mm/mm_init.c: do not calculate memmap and reserved pages for empty zone Haifeng Xu
@ 2023-06-01 16:35 ` Mike Rapoport
0 siblings, 0 replies; 2+ messages in thread
From: Mike Rapoport @ 2023-06-01 16:35 UTC (permalink / raw)
To: Haifeng Xu; +Cc: mhocko, akpm, linux-mm, linux-kernel
On Thu, Jun 01, 2023 at 06:35:36AM +0000, Haifeng Xu wrote:
> For empty zone, it's unnecessary to account for pages used by memmap.
> Also, the pages reserved in dma zone can be ignored.
>
> Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
> ---
> mm/mm_init.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index 232efac9a929..b82718d596c3 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -1543,6 +1543,13 @@ static void __init free_area_init_core(struct pglist_data *pgdat)
> size = zone->spanned_pages;
> freesize = zone->present_pages;
>
> + if (!size) {
> + nr_kernel_pages += 0;
> + nr_all_pages += 0;
Please drop these, they are nops anyway.
> + zone_init_internals(zone, j, nid, 0);
> + continue;
> + }
> +
> /*
> * Adjust freesize so that it accounts for how much memory
> * is used by this zone for memmap. This affects the watermark
> @@ -1579,10 +1586,6 @@ static void __init free_area_init_core(struct pglist_data *pgdat)
> * And all highmem pages will be managed by the buddy system.
> */
> zone_init_internals(zone, j, nid, freesize);
> -
> - if (!size)
> - continue;
> -
> setup_usemap(zone);
> init_currently_empty_zone(zone, zone->zone_start_pfn, size);
> }
> --
> 2.25.1
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-01 16:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-01 6:35 [PATCH 2/2] mm/mm_init.c: do not calculate memmap and reserved pages for empty zone Haifeng Xu
2023-06-01 16:35 ` Mike Rapoport
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox