| 1 |
|
| 2 | |
| 3 | * mm_init.h:
|
| 4 | *
|
| 5 | * mm/ internal mm_init and memblock declarations
|
| 6 |
|
| 7 |
|
| 8 | #ifndef __MM_MM_INIT_H
|
| 9 | #define __MM_MM_INIT_H
|
| 10 |
|
| 11 | #include <linux/types.h>
|
| 12 | #include <linux/init.h>
|
| 13 | #include <linux/mmzone.h>
|
| 14 | #include <linux/jump_label.h>
|
| 15 | #include <linux/printk.h>
|
| 16 |
|
| 17 | struct page;
|
| 18 | struct vmem_altmap;
|
| 19 |
|
| 20 |
|
| 21 | DECLARE_STATIC_KEY_MAYBE(CONFIG_DEBUG_VM, check_pages_enabled);
|
| 22 |
|
| 23 | void set_zone_contiguous(struct zone *zone);
|
| 24 | bool pfn_range_intersects_zones(int nid, unsigned long start_pfn,
|
| 25 | unsigned long nr_pages);
|
| 26 |
|
| 27 | static inline void clear_zone_contiguous(struct zone *zone)
|
| 28 | {
|
| 29 | zone->contiguous = false;
|
| 30 | }
|
| 31 |
|
| 32 | void memblock_free_pages(unsigned long pfn, unsigned int order);
|
| 33 |
|
| 34 | void *memmap_alloc(phys_addr_t size, phys_addr_t align, phys_addr_t min_addr,
|
| 35 | int nid, bool exact_nid);
|
| 36 |
|
| 37 | void memmap_init_range(unsigned long size, int nid, unsigned long zone,
|
| 38 | unsigned long start_pfn, unsigned long zone_end_pfn,
|
| 39 | enum meminit_context context,
|
| 40 | struct vmem_altmap *altmap, int migratetype,
|
| 41 | bool isolate_pageblock);
|
| 42 |
|
| 43 | #if defined CONFIG_COMPACTION || defined CONFIG_CMA
|
| 44 |
|
| 45 | void init_cma_reserved_pageblock(struct page *page);
|
| 46 | #endif
|
| 47 |
|
| 48 | #ifdef CONFIG_CMA
|
| 49 | void init_cma_pageblock(struct page *page);
|
| 50 | #else
|
| 51 | static inline void init_cma_pageblock(struct page *page)
|
| 52 | {
|
| 53 | }
|
| 54 | #endif
|
| 55 |
|
| 56 |
|
| 57 | #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
|
| 58 | DECLARE_STATIC_KEY_TRUE(deferred_pages);
|
| 59 |
|
| 60 | static inline bool deferred_pages_enabled(void)
|
| 61 | {
|
| 62 | return static_branch_unlikely(&deferred_pages);
|
| 63 | }
|
| 64 |
|
| 65 | bool __init deferred_grow_zone(struct zone *zone, unsigned int order);
|
| 66 | #else
|
| 67 | static inline bool deferred_pages_enabled(void)
|
| 68 | {
|
| 69 | return false;
|
| 70 | }
|
| 71 | #endif
|
| 72 |
|
| 73 | void init_deferred_page(unsigned long pfn, int nid);
|
| 74 |
|
| 75 | enum mminit_level {
|
| 76 | MMINIT_WARNING,
|
| 77 | MMINIT_VERIFY,
|
| 78 | MMINIT_TRACE
|
| 79 | };
|
| 80 |
|
| 81 | #ifdef CONFIG_DEBUG_MEMORY_INIT
|
| 82 |
|
| 83 | extern int mminit_loglevel;
|
| 84 |
|
| 85 | #define mminit_dprintk(level, prefix, fmt, arg...) \
|
| 86 | do { \
|
| 87 | if (level < mminit_loglevel) { \
|
| 88 | if (level <= MMINIT_WARNING) \
|
| 89 | pr_warn("mminit::" prefix " " fmt, ##arg); \
|
| 90 | else \
|
| 91 | printk(KERN_DEBUG "mminit::" prefix " " fmt, ##arg); \
|
| 92 | } \
|
| 93 | } while (0)
|
| 94 |
|
| 95 | void mminit_verify_pageflags_layout(void);
|
| 96 | void mminit_verify_zonelist(void);
|
| 97 | #else
|
| 98 |
|
| 99 | static inline void mminit_dprintk(enum mminit_level level,
|
| 100 | const char *prefix, const char *fmt, ...)
|
| 101 | {
|
| 102 | }
|
| 103 |
|
| 104 | static inline void mminit_verify_pageflags_layout(void)
|
| 105 | {
|
| 106 | }
|
| 107 |
|
| 108 | static inline void mminit_verify_zonelist(void)
|
| 109 | {
|
| 110 | }
|
| 111 | #endif
|
| 112 |
|
| 113 | extern bool mirrored_kernelcore;
|
| 114 | bool memblock_has_mirror(void);
|
| 115 | void memblock_free_all(void);
|
| 116 |
|
| 117 | void __meminit __init_single_page(struct page *page, unsigned long pfn,
|
| 118 | unsigned long zone, int nid);
|
| 119 |
|
| 120 | #endif
|