Skip to content

Commit 1c01502

Browse files
fancertsbogend
authored andcommitted
mips: Optimize max_mapnr init procedure
max_mapnr defines the upper boundary of the pages space in the system. Currently in case if HIGHMEM is available it's calculated based on the upper high memory PFN limit value. Seeing there is a case when it isn't fully correct let's optimize out the max_mapnr variable initialization procedure to cover all the handled in the paging_init() method cases: 1. If CPU has DC-aliases, then high memory is unavailable so the PFNs upper boundary is determined by max_low_pfn. 2. Otherwise if high memory is available, use highend_pfn value representing the upper high memory PFNs limit. 3. Otherwise no high memory is available so set max_mapnr with the low-memory upper limit. Signed-off-by: Serge Semin <fancer.lancer@gmail.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent e1a9ae4 commit 1c01502

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

arch/mips/mm/init.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,13 @@ void __init paging_init(void)
421421
" %ldk highmem ignored\n",
422422
(highend_pfn - max_low_pfn) << (PAGE_SHIFT - 10));
423423
max_zone_pfns[ZONE_HIGHMEM] = max_low_pfn;
424-
}
425424

426-
max_mapnr = highend_pfn ? highend_pfn : max_low_pfn;
425+
max_mapnr = max_low_pfn;
426+
} else if (highend_pfn) {
427+
max_mapnr = highend_pfn;
428+
} else {
429+
max_mapnr = max_low_pfn;
430+
}
427431
#else
428432
max_mapnr = max_low_pfn;
429433
#endif

0 commit comments

Comments
 (0)