1 #ifndef __LINUX_MEMORY_HOTPLUG_H
2 #define __LINUX_MEMORY_HOTPLUG_H
15 #ifdef CONFIG_MEMORY_HOTPLUG
22 MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE = 12,
23 SECTION_INFO = MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE,
26 MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO,
40 spin_unlock_irqrestore(&pgdat->node_size_lock, *flags);
50 static inline unsigned zone_span_seqbegin(
struct zone *
zone)
52 return read_seqbegin(&zone->span_seqlock);
54 static inline int zone_span_seqretry(
struct zone *
zone,
unsigned iv)
56 return read_seqretry(&zone->span_seqlock, iv);
58 static inline void zone_span_writelock(
struct zone *
zone)
60 write_seqlock(&zone->span_seqlock);
62 static inline void zone_span_writeunlock(
struct zone *
zone)
64 write_sequnlock(&zone->span_seqlock);
66 static inline void zone_seqlock_init(
struct zone *
zone)
70 extern int zone_grow_free_lists(
struct zone *
zone,
unsigned long new_nr_pages);
71 extern int zone_grow_waitqueues(
struct zone *
zone,
unsigned long nr_pages);
72 extern int add_one_highpage(
struct page *
page,
int pfn,
int bad_ppro);
74 extern int online_pages(
unsigned long,
unsigned long);
75 extern void __offline_isolated_pages(
unsigned long,
unsigned long);
77 typedef void (*online_page_callback_t)(
struct page *
page);
79 extern int set_online_page_callback(online_page_callback_t
callback);
80 extern int restore_online_page_callback(online_page_callback_t
callback);
82 extern void __online_page_set_limits(
struct page *
page);
83 extern void __online_page_increment_counters(
struct page *
page);
84 extern void __online_page_free(
struct page *
page);
86 #ifdef CONFIG_MEMORY_HOTREMOVE
91 extern int __add_pages(
int nid,
struct zone *
zone,
unsigned long start_pfn,
92 unsigned long nr_pages);
93 extern int __remove_pages(
struct zone *
zone,
unsigned long start_pfn,
94 unsigned long nr_pages);
97 extern int memory_add_physaddr_to_nid(
u64 start);
99 static inline int memory_add_physaddr_to_nid(
u64 start)
105 #ifdef CONFIG_HAVE_ARCH_NODEDATA_EXTENSION
116 extern pg_data_t *arch_alloc_nodedata(
int nid);
117 extern void arch_free_nodedata(
pg_data_t *pgdat);
118 extern void arch_refresh_nodedata(
int nid,
pg_data_t *pgdat);
122 #define arch_alloc_nodedata(nid) generic_alloc_nodedata(nid)
123 #define arch_free_nodedata(pgdat) generic_free_nodedata(pgdat)
132 #define generic_alloc_nodedata(nid) \
134 kzalloc(sizeof(pg_data_t), GFP_KERNEL); \
140 #define generic_free_nodedata(pgdat) kfree(pgdat)
143 static inline void arch_refresh_nodedata(
int nid,
pg_data_t *pgdat)
145 node_data[nid] = pgdat;
151 static inline pg_data_t *generic_alloc_nodedata(
int nid)
156 static inline void generic_free_nodedata(
pg_data_t *pgdat)
159 static inline void arch_refresh_nodedata(
int nid,
pg_data_t *pgdat)
165 #ifdef CONFIG_SPARSEMEM_VMEMMAP
166 static inline void register_page_bootmem_info_node(
struct pglist_data *pgdat)
169 static inline void put_page_bootmem(
struct page *
page)
173 extern void register_page_bootmem_info_node(
struct pglist_data *pgdat);
174 extern void put_page_bootmem(
struct page *
page);
190 static inline void pgdat_resize_lock(
struct pglist_data *
p,
unsigned long *
f) {}
191 static inline void pgdat_resize_unlock(
struct pglist_data *
p,
unsigned long *
f) {}
192 static inline void pgdat_resize_init(
struct pglist_data *pgdat) {}
194 static inline unsigned zone_span_seqbegin(
struct zone *
zone)
198 static inline int zone_span_seqretry(
struct zone *
zone,
unsigned iv)
202 static inline void zone_span_writelock(
struct zone *
zone) {}
203 static inline void zone_span_writeunlock(
struct zone *
zone) {}
204 static inline void zone_seqlock_init(
struct zone *
zone) {}
206 static inline int mhp_notimplemented(
const char *
func)
213 static inline void register_page_bootmem_info_node(
struct pglist_data *pgdat)
222 #ifdef CONFIG_MEMORY_HOTREMOVE
224 extern int is_mem_section_removable(
unsigned long pfn,
unsigned long nr_pages);
227 static inline int is_mem_section_removable(
unsigned long pfn,
228 unsigned long nr_pages)
237 extern int offline_pages(
unsigned long start_pfn,
unsigned long nr_pages);