]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - include/linux/memory_hotplug.h
4b08bc947578680ce4f014e986e19a90e2dba00e
[linux-2.6-omap-h63xx.git] / include / linux / memory_hotplug.h
1 #ifndef __LINUX_MEMORY_HOTPLUG_H
2 #define __LINUX_MEMORY_HOTPLUG_H
3
4 #include <linux/mmzone.h>
5 #include <linux/spinlock.h>
6
7 #ifdef CONFIG_MEMORY_HOTPLUG
8 /*
9  * pgdat resizing functions
10  */
11 static inline
12 void pgdat_resize_lock(struct pglist_data *pgdat, unsigned long *flags)
13 {
14         spin_lock_irqsave(&pgdat->node_size_lock, *flags);
15 }
16 static inline
17 void pgdat_resize_unlock(struct pglist_data *pgdat, unsigned long *flags)
18 {
19         spin_unlock_irqrestore(&pgdat->node_size_lock, *flags);
20 }
21 static inline
22 void pgdat_resize_init(struct pglist_data *pgdat)
23 {
24         spin_lock_init(&pgdat->node_size_lock);
25 }
26 /*
27  * Zone resizing functions
28  */
29 static inline unsigned zone_span_seqbegin(struct zone *zone)
30 {
31         return read_seqbegin(&zone->span_seqlock);
32 }
33 static inline int zone_span_seqretry(struct zone *zone, unsigned iv)
34 {
35         return read_seqretry(&zone->span_seqlock, iv);
36 }
37 static inline void zone_span_writelock(struct zone *zone)
38 {
39         write_seqlock(&zone->span_seqlock);
40 }
41 static inline void zone_span_writeunlock(struct zone *zone)
42 {
43         write_sequnlock(&zone->span_seqlock);
44 }
45 static inline void zone_seqlock_init(struct zone *zone)
46 {
47         seqlock_init(&zone->span_seqlock);
48 }
49 #else /* ! CONFIG_MEMORY_HOTPLUG */
50 /*
51  * Stub functions for when hotplug is off
52  */
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) {}
56
57 static inline unsigned zone_span_seqbegin(struct zone *zone)
58 {
59         return 0;
60 }
61 static inline int zone_span_seqretry(struct zone *zone, unsigned iv)
62 {
63         return 0;
64 }
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 */