[PATCH 04/10] mm/bootmem_info: allow calling free_bootmem_page() on pages without a bootmem_type

From: David Hildenbrand (Arm)

Date: Wed Jul 08 2026 - 10:24:39 EST


As preparation for further changes, let's temporarily allow freeing
pages that were not previously registered.

This will allow freeing unregistered vmemmap pages allocated during boot
through free_bootmem_page() from hugetlb code, until we fully rip all
of that out.

Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
---
include/linux/bootmem_info.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/bootmem_info.h b/include/linux/bootmem_info.h
index f724340755e55..486acc6127039 100644
--- a/include/linux/bootmem_info.h
+++ b/include/linux/bootmem_info.h
@@ -44,12 +44,12 @@ static inline void free_bootmem_page(struct page *page)
{
enum bootmem_type type = bootmem_type(page);

- VM_BUG_ON_PAGE(page_ref_count(page) != 2, page);
-
- if (type == SECTION_INFO || type == MIX_SECTION_INFO)
+ if (type == SECTION_INFO || type == MIX_SECTION_INFO) {
+ VM_WARN_ON_PAGE(page_ref_count(page) != 2, page);
put_page_bootmem(page);
- else
- VM_BUG_ON_PAGE(1, page);
+ } else {
+ free_reserved_page(page);
+ }
}
#else
static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)

--
2.43.0