mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-30 13:52:50 +01:00
The call to kmemleak_free_part_phys() was added in 2022 in commitdd0ff4d12d("bootmem: remove the vmemmap pages from kmemleak in put_page_bootmem"). In 2025, commitb2aad24b53("mm/memmap: prevent double scanning of memmap by kmemleak") started to use MEMBLOCK_ALLOC_NOLEAKTRACE when allocating the memmap to skip the kmemleak_alloc_phys() in the buddy. So remove the call to kmemleak_free_part_phys(). If this would still be required for other purposes, either free_reserved_page() should take care of it, or selected users. Link: https://lore.kernel.org/[email protected] Signed-off-by: David Hildenbrand (Arm) <[email protected]> Reviewed-by: Oscar Salvador <[email protected]> Reviewed-by: Mike Rapoport (Microsoft) <[email protected]> Tested-by: Lance Yang <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Andreas Larsson <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: David S. Miller <[email protected]> Cc: Gerald Schaefer <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Liam R. Howlett <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Madhavan Srinivasan <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Ritesh Harjani (IBM) <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
90 lines
2.1 KiB
C
90 lines
2.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __LINUX_BOOTMEM_INFO_H
|
|
#define __LINUX_BOOTMEM_INFO_H
|
|
|
|
#include <linux/mm.h>
|
|
#include <linux/kmemleak.h>
|
|
|
|
/*
|
|
* Types for free bootmem stored in the low bits of page->private.
|
|
*/
|
|
enum bootmem_type {
|
|
MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE = 1,
|
|
SECTION_INFO = MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE,
|
|
MIX_SECTION_INFO,
|
|
NODE_INFO,
|
|
MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO,
|
|
};
|
|
|
|
#ifdef CONFIG_HAVE_BOOTMEM_INFO_NODE
|
|
void __init register_page_bootmem_info_node(struct pglist_data *pgdat);
|
|
void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
|
|
unsigned long nr_pages);
|
|
|
|
void get_page_bootmem(unsigned long info, struct page *page,
|
|
enum bootmem_type type);
|
|
void put_page_bootmem(struct page *page);
|
|
|
|
static inline enum bootmem_type bootmem_type(const struct page *page)
|
|
{
|
|
return (unsigned long)page->private & 0xf;
|
|
}
|
|
|
|
static inline unsigned long bootmem_info(const struct page *page)
|
|
{
|
|
return (unsigned long)page->private >> 4;
|
|
}
|
|
|
|
/*
|
|
* Any memory allocated via the memblock allocator and not via the
|
|
* buddy will be marked reserved already in the memmap. For those
|
|
* pages, we can call this function to free it to buddy allocator.
|
|
*/
|
|
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)
|
|
put_page_bootmem(page);
|
|
else
|
|
VM_BUG_ON_PAGE(1, page);
|
|
}
|
|
#else
|
|
static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
|
|
{
|
|
}
|
|
|
|
static inline void register_page_bootmem_memmap(unsigned long section_nr,
|
|
struct page *map, unsigned long nr_pages)
|
|
{
|
|
}
|
|
|
|
static inline void put_page_bootmem(struct page *page)
|
|
{
|
|
}
|
|
|
|
static inline enum bootmem_type bootmem_type(const struct page *page)
|
|
{
|
|
return SECTION_INFO;
|
|
}
|
|
|
|
static inline unsigned long bootmem_info(const struct page *page)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void get_page_bootmem(unsigned long info, struct page *page,
|
|
enum bootmem_type type)
|
|
{
|
|
}
|
|
|
|
static inline void free_bootmem_page(struct page *page)
|
|
{
|
|
free_reserved_page(page);
|
|
}
|
|
#endif
|
|
|
|
#endif /* __LINUX_BOOTMEM_INFO_H */
|