1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LINUX_BOOTMEM_INFO_H
3 #define __LINUX_BOOTMEM_INFO_H
6 #include <linux/kmemleak.h>
9 * Types for free bootmem stored in page->lru.next. These have to be in
10 * some random range in unsigned long space for debugging purposes.
13 MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE = 12,
14 SECTION_INFO = MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE,
17 MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO,
20 #ifdef CONFIG_HAVE_BOOTMEM_INFO_NODE
21 void __init register_page_bootmem_info_node(struct pglist_data *pgdat);
23 void get_page_bootmem(unsigned long info, struct page *page,
25 void put_page_bootmem(struct page *page);
28 * Any memory allocated via the memblock allocator and not via the
29 * buddy will be marked reserved already in the memmap. For those
30 * pages, we can call this function to free it to buddy allocator.
32 static inline void free_bootmem_page(struct page *page)
34 unsigned long magic = page->index;
37 * The reserve_bootmem_region sets the reserved flag on bootmem
40 VM_BUG_ON_PAGE(page_ref_count(page) != 2, page);
42 if (magic == SECTION_INFO || magic == MIX_SECTION_INFO)
43 put_page_bootmem(page);
45 VM_BUG_ON_PAGE(1, page);
48 static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
52 static inline void put_page_bootmem(struct page *page)
56 static inline void get_page_bootmem(unsigned long info, struct page *page,
61 static inline void free_bootmem_page(struct page *page)
63 kmemleak_free_part_phys(PFN_PHYS(page_to_pfn(page)), PAGE_SIZE);
64 free_reserved_page(page);
68 #endif /* __LINUX_BOOTMEM_INFO_H */