lkml.org 
[lkml]   [2022]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 3/9] mm/page_alloc: prevent creation of empty zones
Date
If none of the pages a zone spans are present then its start pfn
and span should be zeroed to prevent initialization.

This prevents the creation of an empty zone if all of its pages
are moved to a zone that would overlap it.

The real_size name is reverted to just size to reduce the burden
of supporting multiple realities.

Signed-off-by: Doug Berger <opendmb@gmail.com>
---
mm/page_alloc.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 92908c51f1c3..2f7b88d78bc2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7548,8 +7548,7 @@ static void __init calculate_node_totalpages(struct pglist_data *pgdat,
for (i = 0; i < MAX_NR_ZONES; i++) {
struct zone *zone = pgdat->node_zones + i;
unsigned long zone_start_pfn, zone_end_pfn;
- unsigned long spanned, absent;
- unsigned long size, real_size;
+ unsigned long spanned, absent, size;

spanned = zone_spanned_pages_in_node(pgdat->node_id, i,
node_start_pfn,
@@ -7560,20 +7559,21 @@ static void __init calculate_node_totalpages(struct pglist_data *pgdat,
node_start_pfn,
node_end_pfn);

- size = spanned;
- real_size = size - absent;
+ size = spanned - absent;

- if (size)
+ if (size) {
zone->zone_start_pfn = zone_start_pfn;
- else
+ } else {
+ spanned = 0;
zone->zone_start_pfn = 0;
- zone->spanned_pages = size;
- zone->present_pages = real_size;
+ }
+ zone->spanned_pages = spanned;
+ zone->present_pages = size;
#if defined(CONFIG_MEMORY_HOTPLUG)
- zone->present_early_pages = real_size;
+ zone->present_early_pages = size;
#endif

- totalpages += real_size;
+ totalpages += size;
}

pgdat->node_spanned_pages = node_end_pfn - node_start_pfn;
--
2.25.1
\
 
 \ /
  Last update: 2022-10-20 23:55    [W:0.115 / U:3.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site