Skip to contentSkip to conversation

x86/mm: calculate the proper boundary in register_page_bootmem_memmap()

PATCH New Wei Yang 1 participant 1 message Jun 30, 2020

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 x86/mm: calculate the proper boundary in register_page_bootmem_memmap()

It would be proper to jump to end boundary of the proper level instead of always jump to the end boundary of a PAGE.

CC Baoquan He <[email protected]>
CC Kirill A. Shutemov <[email protected]>
---
 arch/x86/mm/init_64.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/mm/init_64.c +3 -3
index f902fbd17f27..45eddb755eaa 100644
@@ -1536,21 +1536,21 @@ void register_page_bootmem_memmap(unsigned long section_nr,
 
 		pgd = pgd_offset_k(addr);
 		if (pgd_none(*pgd)) {
-			next = (addr + PAGE_SIZE) & PAGE_MASK;
+			next = pgd_addr_end(addr, end);
 			continue;
 		}
 		get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
 
 		p4d = p4d_offset(pgd, addr);
 		if (p4d_none(*p4d)) {
-			next = (addr + PAGE_SIZE) & PAGE_MASK;
+			next = p4d_addr_end(addr, end);
 			continue;
 		}
 		get_page_bootmem(section_nr, p4d_page(*p4d), MIX_SECTION_INFO);
 
 		pud = pud_offset(p4d, addr);
 		if (pud_none(*pud)) {
-			next = (addr + PAGE_SIZE) & PAGE_MASK;
+			next = pud_addr_end(addr, end);
 			continue;
 		}
 		get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
Signature · 1 line
2.20.1 (Apple Git-117)