mm-hugetlb-defer-vmemmap-population-for-bootmem-hugepages.patch removed from -mm tree
The quilt patch titled
Subject: mm/hugetlb: defer vmemmap population for bootmem hugepages
has been removed from the -mm tree. Its filename was
mm-hugetlb-defer-vmemmap-population-for-bootmem-hugepages.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: "Kiryl Shutsemau (Meta)" <[email protected]>
Subject: mm/hugetlb: defer vmemmap population for bootmem hugepages
Date: Fri, 27 Feb 2026 19:42:47 +0000
Currently, the vmemmap for bootmem-allocated gigantic pages is populated early in hugetlb_vmemmap_init_early(). However, the zone information is only available after zones are initialized. If it is later discovered that a page spans multiple zones, the HVO mapping must be undone and replaced with a normal mapping using vmemmap_undo_hvo().
Defer the actual vmemmap population to hugetlb_vmemmap_init_late(). At this stage, zones are already initialized, so it can be checked if the page is valid for HVO before deciding how to populate the vmemmap.
This allows us to remove vmemmap_undo_hvo() and the complex logic required to rollback HVO mappings.
In hugetlb_vmemmap_init_late(), if HVO population fails or if the zones are invalid, fall back to a normal vmemmap population.
Postponing population until hugetlb_vmemmap_init_late() also makes zone information available from within vmemmap_populate_hvo().
---
include/linux/mm.h | 2 - mm/hugetlb_vmemmap.c | 37 +++++++++++++--------------- mm/sparse-vmemmap.c | 53 ----------------------------------------- 3 files changed, 18 insertions(+), 74 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~mm-hugetlb-defer-vmemmap-population-for-bootmem-hugepages +0 -2
@@ -4474,8 +4474,6 @@ int vmemmap_populate(unsigned long start struct vmem_altmap *altmap);int vmemmap_populate_hvo (unsigned long start,unsigned long end,int node,unsigned long headsize); -int vmemmap_undo_hvo (unsigned long start,unsigned long end,int node, -unsigned long headsize);void vmemmap_wrprotect_hvo (unsigned long start,unsigned long end,int node,unsigned long headsize);void vmemmap_populate_print_last (void );
mm/hugetlb_vmemmap.c renamed from mm/hugetlb_vmemmap.c~mm-hugetlb-defer-vmemmap-population-for-bootmem-hugepages +18 -19
@@ -790,7 +790,6 @@ void __init hugetlb_vmemmap_init_early(i {unsigned long psize, paddr, section_size;unsigned long ns, i, pnum, pfn, nr_pages; -unsigned long start, end;struct huge_bootmem_page *m =NULL ;void *map;
@@ -808,14 +807,6 @@ void __init hugetlb_vmemmap_init_early(i paddr =virt_to_phys (m); pfn =PHYS_PFN (paddr); map =pfn_to_page (pfn); - start = (unsigned long )map; - end = start + nr_pages *sizeof (struct page ); - -if (vmemmap_populate_hvo (start, end, nid, -HUGETLB_VMEMMAP_RESERVE_SIZE ) <0 ) -continue ; - -memmap_boot_pages_add (HUGETLB_VMEMMAP_RESERVE_SIZE /PAGE_SIZE ); pnum =pfn_to_section_nr (pfn); ns = psize / section_size;
@@ -850,28 +841,36 @@ void __init hugetlb_vmemmap_init_late(in h = m->hstate; pfn =PHYS_PFN (phys); nr_pages =pages_per_huge_page (h); + map =pfn_to_page (pfn); + start = (unsigned long )map; + end = start + nr_pages *sizeof (struct page );if (!hugetlb_bootmem_page_zones_valid (nid, m)) {/* * Oops, the hugetlb page spans multiple zones. -* Remove it from the list, and undo HVO. +* Remove it from the list, and populate it normally. */ list_del (&m->list); - map =pfn_to_page (pfn); - - start = (unsigned long )map; - end = start + nr_pages *sizeof (struct page ); - -vmemmap_undo_hvo (start, end, nid, -HUGETLB_VMEMMAP_RESERVE_SIZE ); - nr_mmap = end - start -HUGETLB_VMEMMAP_RESERVE_SIZE ; +vmemmap_populate (start, end, nid,NULL ); + nr_mmap = end - start;memmap_boot_pages_add (DIV_ROUND_UP (nr_mmap,PAGE_SIZE ));memblock_phys_free (phys,huge_page_size (h));continue ; - }else + } + +if (vmemmap_populate_hvo (start, end, nid, +HUGETLB_VMEMMAP_RESERVE_SIZE ) <0 ) { +/* Fallback if HVO population fails */ +vmemmap_populate (start, end, nid,NULL ); + nr_mmap = end - start; + }else { m->flags |=HUGE_BOOTMEM_ZONES_VALID ; + nr_mmap =HUGETLB_VMEMMAP_RESERVE_SIZE ; + } + + memmap_boot_pages_add(DIV_ROUND_UP(nr_mmap, PAGE_SIZE)); } }#endif
mm/sparse-vmemmap.c renamed from mm/sparse-vmemmap.c~mm-hugetlb-defer-vmemmap-population-for-bootmem-hugepages +0 -53
59 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are