Files
Linus Torvalds 394023fbe3 Merge tag 'memblock-v7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mm/memblock
Pull memblock updates from Mike Rapoport:
 "Performance improvement:

   - Use binary search in memblock_add_range() and
     memblock_isolate_range()

  Cleanups:

   - Several simplifications in memblock and mm_init that remove
     redundant code

   - After rework of sparsemem buffer preallocation, memmap_alloc() does
     not require exact_nid parameter. Remove that parameter, drop now
     unused memblock_alloc_exact_nid_raw() and adjust memblock tests
     accordingly

  memblock test updates:

   - add coverage for lowmem allocations

   - fix 32-bit build warnings"

* tag 'memblock-v7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mm/memblock:
  memblock: use binary search to locate candidate regions
  memblock: drop for_each_memblock_type() and open code its users
  memblock: Remove unused memblock_alloc_exact_nid_raw()
  memblock tests: Move exact nid tests to memblock_alloc_range_nid()
  mm: Remove unused exact_nid parameter from memmap_alloc()
  memblock: initialize the region merge end index
  tools: use __pa() in virt_to_phys()
  memblock tests: zero-extend simulated memory addresses
  memblock tests: use physical addresses for region removal
  memblock: reject non-page-aligned reserve_mem regions
  memblock tests: cover allocations below the low address limit
  memblock tests: model the low allocation limit within dummy memory
  mm/mm_init: remove zone_absent_pages_in_node()
  memblock: remove conditional return with no effect
  memblock: simplify reset_all_zones_managed_pages()
2026-10-25 17:27:19 -10:00

116 lines
2.7 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* mm_init.h:
*
* mm/ internal mm_init and memblock declarations
*/
#ifndef __MM_MM_INIT_H
#define __MM_MM_INIT_H
#include <linux/types.h>
#include <linux/init.h>
#include <linux/mmzone.h>
#include <linux/jump_label.h>
#include <linux/printk.h>
struct page;
struct vmem_altmap;
/* perform sanity checks on struct pages being allocated or freed */
DECLARE_STATIC_KEY_MAYBE(CONFIG_DEBUG_VM, check_pages_enabled);
bool pfn_range_intersects_zones(int nid, unsigned long start_pfn,
unsigned long nr_pages);
void memblock_free_pages(unsigned long pfn, unsigned int order);
void *memmap_alloc(phys_addr_t size, phys_addr_t align,
phys_addr_t min_addr, int nid);
void memmap_init_range(unsigned long size, int nid, unsigned long zone,
unsigned long start_pfn, unsigned long zone_end_pfn,
enum meminit_context context,
struct vmem_altmap *altmap, int migratetype,
bool isolate_pageblock);
struct zone *pfn_to_zone(unsigned long pfn, int nid);
#if defined CONFIG_COMPACTION || defined CONFIG_CMA
/* Free whole pageblock and set its migration type to MIGRATE_CMA. */
void init_cma_reserved_pageblock(struct page *page);
#endif
#ifdef CONFIG_CMA
void init_cma_pageblock(struct page *page);
#else
static inline void init_cma_pageblock(struct page *page)
{
}
#endif
/* Memory initialisation debug and verification */
#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
DECLARE_STATIC_KEY_TRUE(deferred_pages);
static inline bool deferred_pages_enabled(void)
{
return static_branch_unlikely(&deferred_pages);
}
bool __init deferred_grow_zone(struct zone *zone, unsigned int order);
#else
static inline bool deferred_pages_enabled(void)
{
return false;
}
#endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */
void init_deferred_page(unsigned long pfn, int nid);
enum mminit_level {
MMINIT_WARNING,
MMINIT_VERIFY,
MMINIT_TRACE
};
#ifdef CONFIG_DEBUG_MEMORY_INIT
extern int mminit_loglevel;
#define mminit_dprintk(level, prefix, fmt, arg...) \
do { \
if (level < mminit_loglevel) { \
if (level <= MMINIT_WARNING) \
pr_warn("mminit::" prefix " " fmt, ##arg); \
else \
printk(KERN_DEBUG "mminit::" prefix " " fmt, ##arg); \
} \
} while (0)
void mminit_verify_pageflags_layout(void);
void mminit_verify_zonelist(void);
#else
static inline void mminit_dprintk(enum mminit_level level,
const char *prefix, const char *fmt, ...)
{
}
static inline void mminit_verify_pageflags_layout(void)
{
}
static inline void mminit_verify_zonelist(void)
{
}
#endif /* CONFIG_DEBUG_MEMORY_INIT */
extern bool mirrored_kernelcore;
bool memblock_has_mirror(void);
void memblock_free_all(void);
void __meminit __init_single_page(struct page *page, unsigned long pfn,
unsigned long zone, int nid);
#endif /* __MM_MM_INIT_H */