[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230311003855.645684-3-opendmb@gmail.com>
Date: Fri, 10 Mar 2023 16:38:48 -0800
From: Doug Berger <opendmb@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Jonathan Corbet <corbet@....net>, Mike Rapoport <rppt@...nel.org>,
Borislav Petkov <bp@...e.de>,
"Paul E. McKenney" <paulmck@...nel.org>,
Randy Dunlap <rdunlap@...radead.org>,
Neeraj Upadhyay <quic_neeraju@...cinc.com>,
Damien Le Moal <damien.lemoal@...nsource.wdc.com>,
Kim Phillips <kim.phillips@....com>,
"Steven Rostedt (Google)" <rostedt@...dmis.org>,
Michal Hocko <mhocko@...e.com>,
Johannes Weiner <hannes@...xchg.org>,
Vlastimil Babka <vbabka@...e.cz>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Mel Gorman <mgorman@...e.de>,
Muchun Song <songmuchun@...edance.com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Florian Fainelli <f.fainelli@...il.com>,
David Hildenbrand <david@...hat.com>,
Oscar Salvador <osalvador@...e.de>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Sukadev Bhattiprolu <quic_sukadev@...cinc.com>,
Rik van Riel <riel@...riel.com>,
Roman Gushchin <guro@...com>, Minchan Kim <minchan@...nel.org>,
Chris Goldsworthy <quic_cgoldswo@...cinc.com>,
"Georgi Djakov" <quic_c_gdjako@...cinc.com>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Doug Berger <opendmb@...il.com>
Subject: [PATCH v4 2/9] mm/page_alloc: calculate node_spanned_pages from pfns
Since the start and end pfns of the node are passed as arguments
to calculate_node_totalpages() they might as well be used to
specify the node_spanned_pages value for the node rather than
accumulating the spans of member zones.
This prevents the need for additional adjustments if zones are
allowed to overlap.
The realtotalpages name is reverted to just totalpages to reduce
the burden of supporting multiple realities.
Signed-off-by: Doug Berger <opendmb@...il.com>
---
mm/page_alloc.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ac1fc986af44..b1952f86ab6d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7586,7 +7586,7 @@ static void __init calculate_node_totalpages(struct pglist_data *pgdat,
unsigned long node_start_pfn,
unsigned long node_end_pfn)
{
- unsigned long realtotalpages = 0, totalpages = 0;
+ unsigned long totalpages = 0;
enum zone_type i;
for (i = 0; i < MAX_NR_ZONES; i++) {
@@ -7617,13 +7617,12 @@ static void __init calculate_node_totalpages(struct pglist_data *pgdat,
zone->present_early_pages = real_size;
#endif
- totalpages += size;
- realtotalpages += real_size;
+ totalpages += real_size;
}
- pgdat->node_spanned_pages = totalpages;
- pgdat->node_present_pages = realtotalpages;
- pr_debug("On node %d totalpages: %lu\n", pgdat->node_id, realtotalpages);
+ pgdat->node_spanned_pages = node_end_pfn - node_start_pfn;
+ pgdat->node_present_pages = totalpages;
+ pr_debug("On node %d totalpages: %lu\n", pgdat->node_id, totalpages);
}
#ifndef CONFIG_SPARSEMEM
--
2.34.1
Powered by blists - more mailing lists