Skip to contentSkip to conversation

x86-mm-make-register_page_bootmem_memmap-handle-pte-mappings.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 17, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: x86/mm: make register_page_bootmem_memmap handle PTE mappings
has been removed from the -mm tree. Its filename was
x86-mm-make-register_page_bootmem_memmap-handle-pte-mappings.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Frank van der Linden <[email protected]>
Subject: x86/mm: make register_page_bootmem_memmap handle PTE mappings
Date: Fri, 28 Feb 2025 18:29:09 +0000

register_page_bootmem_memmap expects that vmemmap pages handed to it are PMD-mapped, and that the number of pages to call get_page_bootmem on is PMD-aligned.

This is currently a correct assumption, but will no longer be true once pre-HVO of hugetlb pages is implemented.

Make it handle PTE-mapped vmemmap pages and a nr_pages argument that is not necessarily PAGES_PER_SECTION.

Cc Dave Hansen <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Dan Carpenter <[email protected]>
Cc Alexander Gordeev <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Joao Martins <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Madhavan Srinivasan <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Muchun Song <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Roman Gushchin (Cruise) <[email protected]>
Cc Usama Arif <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Yu Zhao <[email protected]>
Cc Zi Yan <[email protected]>

---

 arch/x86/mm/init_64.c |   18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
arch/x86/mm/init_64.c renamed from arch/x86/mm/init_64.c~x86-mm-make-register_page_bootmem_memmap-handle-pte-mappings +8 -10
@@ -1599,11 +1599,14 @@ void register_page_bootmem_memmap(unsign
 		}
 		get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
 
-		if (!boot_cpu_has(X86_FEATURE_PSE)) {
+		pmd = pmd_offset(pud, addr);
+		if (pmd_none(*pmd)) {
+			next = (addr + PAGE_SIZE) & PAGE_MASK;
+			continue;
+		}
+
+		if (!boot_cpu_has(X86_FEATURE_PSE) || !pmd_leaf(*pmd)) {
 			next = (addr + PAGE_SIZE) & PAGE_MASK;
-			pmd = pmd_offset(pud, addr);
-			if (pmd_none(*pmd))
-				continue;
 			get_page_bootmem(section_nr, pmd_page(*pmd),
 					 MIX_SECTION_INFO);
 
@@ -1614,12 +1617,7 @@ void register_page_bootmem_memmap(unsign
 					 SECTION_INFO);
 		} else {
 			next = pmd_addr_end(addr, end);
-
-			pmd = pmd_offset(pud, addr);
-			if (pmd_none(*pmd))
-				continue;
-
-			nr_pmd_pages = 1 << get_order(PMD_SIZE);
+			nr_pmd_pages = (next - addr) >> PAGE_SHIFT;
 			page = pmd_page(*pmd);
 			while (nr_pmd_pages--)
 				get_page_bootmem(section_nr, page++,

_

Patches currently in -mm which might be from [email protected] are