1 #ifndef __LINUX_MEMORY_HOTPLUG_H
2 #define __LINUX_MEMORY_HOTPLUG_H
4 #include <linux/mmzone.h>
5 #include <linux/spinlock.h>
7 #ifdef CONFIG_MEMORY_HOTPLUG
9 * pgdat resizing functions
12 void pgdat_resize_lock(struct pglist_data *pgdat, unsigned long *flags)
14 spin_lock_irqsave(&pgdat->node_size_lock, *flags);
17 void pgdat_resize_unlock(struct pglist_data *pgdat, unsigned long *flags)
19 spin_unlock_irqrestore(&pgdat->node_size_lock, *flags);
22 void pgdat_resize_init(struct pglist_data *pgdat)
24 spin_lock_init(&pgdat->node_size_lock);
27 * Zone resizing functions
29 static inline unsigned zone_span_seqbegin(struct zone *zone)
31 return read_seqbegin(&zone->span_seqlock);
33 static inline int zone_span_seqretry(struct zone *zone, unsigned iv)
35 return read_seqretry(&zone->span_seqlock, iv);
37 static inline void zone_span_writelock(struct zone *zone)
39 write_seqlock(&zone->span_seqlock);
41 static inline void zone_span_writeunlock(struct zone *zone)
43 write_sequnlock(&zone->span_seqlock);
45 static inline void zone_seqlock_init(struct zone *zone)
47 seqlock_init(&zone->span_seqlock);
49 #else /* ! CONFIG_MEMORY_HOTPLUG */
51 * Stub functions for when hotplug is off
53 static inline void pgdat_resize_lock(struct pglist_data *p, unsigned long *f) {}
54 static inline void pgdat_resize_unlock(struct pglist_data *p, unsigned long *f) {}
55 static inline void pgdat_resize_init(struct pglist_data *pgdat) {}
57 static inline unsigned zone_span_seqbegin(struct zone *zone)
61 static inline int zone_span_seqretry(struct zone *zone, unsigned iv)
65 static inline void zone_span_writelock(struct zone *zone) {}
66 static inline void zone_span_writeunlock(struct zone *zone) {}
67 static inline void zone_seqlock_init(struct zone *zone) {}
68 #endif /* ! CONFIG_MEMORY_HOTPLUG */
69 #endif /* __LINUX_MEMORY_HOTPLUG_H */