Skip to content

Commit 1229ace

Browse files
committed
MIPS: Loongson3,SGI-IP27: Simplify max_low_pfn calculation
Both the Loongson3 & SGI-IP27 platforms set max_low_pfn to the last available PFN describing memory. They both do it in paging_init() which is later than ideal since max_low_pfn is used before that function is called. Simplify both platforms to trivially initialize max_low_pfn using the end address of DRAM, and do it earlier in prom_meminit(). Signed-off-by: Paul Burton <paul.burton@mips.com> Suggested-by: Mike Rapoport <rppt@linux.ibm.com> Tested-by: Thomas Bogendoerfer <tbogendoerfer@suse.de> Patchwork: https://patchwork.linux-mips.org/patch/21104/ References: https://patchwork.linux-mips.org/patch/21031/ Cc: Huacai Chen <chenhc@lemote.com> Cc: Mike Rapoport <rppt@linux.ibm.com> Cc: Thomas Bogendoerfer <tbogendoerfer@suse.de> Cc: linux-mips@linux-mips.org
1 parent 25517ed commit 1229ace

File tree

2 files changed

+3
-20
lines changed

2 files changed

+3
-20
lines changed

arch/mips/loongson64/loongson-3/numa.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ static __init void prom_meminit(void)
231231
cpumask_clear(&__node_data[(node)]->cpumask);
232232
}
233233
}
234+
max_low_pfn = PHYS_PFN(memblock_end_of_DRAM());
235+
234236
for (cpu = 0; cpu < loongson_sysconf.nr_cpus; cpu++) {
235237
node = cpu / loongson_sysconf.cores_per_node;
236238
if (node >= num_online_nodes())
@@ -248,19 +250,9 @@ static __init void prom_meminit(void)
248250

249251
void __init paging_init(void)
250252
{
251-
unsigned node;
252253
unsigned long zones_size[MAX_NR_ZONES] = {0, };
253254

254255
pagetable_init();
255-
256-
for_each_online_node(node) {
257-
unsigned long start_pfn, end_pfn;
258-
259-
get_pfn_range_for_nid(node, &start_pfn, &end_pfn);
260-
261-
if (end_pfn > max_low_pfn)
262-
max_low_pfn = end_pfn;
263-
}
264256
#ifdef CONFIG_ZONE_DMA32
265257
zones_size[ZONE_DMA32] = MAX_DMA32_PFN;
266258
#endif

arch/mips/sgi-ip27/ip27-memory.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ void __init prom_meminit(void)
435435

436436
mlreset();
437437
szmem();
438+
max_low_pfn = PHYS_PFN(memblock_end_of_DRAM());
438439

439440
for (node = 0; node < MAX_COMPACT_NODES; node++) {
440441
if (node_online(node)) {
@@ -455,18 +456,8 @@ extern void setup_zero_pages(void);
455456
void __init paging_init(void)
456457
{
457458
unsigned long zones_size[MAX_NR_ZONES] = {0, };
458-
unsigned node;
459459

460460
pagetable_init();
461-
462-
for_each_online_node(node) {
463-
unsigned long start_pfn, end_pfn;
464-
465-
get_pfn_range_for_nid(node, &start_pfn, &end_pfn);
466-
467-
if (end_pfn > max_low_pfn)
468-
max_low_pfn = end_pfn;
469-
}
470461
zones_size[ZONE_NORMAL] = max_low_pfn;
471462
free_area_init_nodes(zones_size);
472463
}

0 commit comments

Comments
 (0)