diff options
author | Dave Hansen <haveblue@us.ibm.com> | 2005-10-29 21:16:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-30 00:40:44 -0400 |
commit | bdc8cb984576ab5b550c8b24c6fa111a873503e3 (patch) | |
tree | f94548988874caa10d770e6e65bc50c925abf825 /include/linux/memory_hotplug.h | |
parent | 208d54e5513c0c02d85af0990901354c74364d5c (diff) |
[PATCH] memory hotplug locking: zone span seqlock
See the "fixup bad_range()" patch for more information, but this actually
creates a the lock to protect things making assumptions about a zone's size
staying constant at runtime.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/memory_hotplug.h')
-rw-r--r-- | include/linux/memory_hotplug.h | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index e8103be9d528..4b08bc947578 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h | |||
@@ -16,13 +16,36 @@ void pgdat_resize_lock(struct pglist_data *pgdat, unsigned long *flags) | |||
16 | static inline | 16 | static inline |
17 | void pgdat_resize_unlock(struct pglist_data *pgdat, unsigned long *flags) | 17 | void pgdat_resize_unlock(struct pglist_data *pgdat, unsigned long *flags) |
18 | { | 18 | { |
19 | spin_lock_irqrestore(&pgdat->node_size_lock, *flags); | 19 | spin_unlock_irqrestore(&pgdat->node_size_lock, *flags); |
20 | } | 20 | } |
21 | static inline | 21 | static inline |
22 | void pgdat_resize_init(struct pglist_data *pgdat) | 22 | void pgdat_resize_init(struct pglist_data *pgdat) |
23 | { | 23 | { |
24 | spin_lock_init(&pgdat->node_size_lock); | 24 | spin_lock_init(&pgdat->node_size_lock); |
25 | } | 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 | } | ||
26 | #else /* ! CONFIG_MEMORY_HOTPLUG */ | 49 | #else /* ! CONFIG_MEMORY_HOTPLUG */ |
27 | /* | 50 | /* |
28 | * Stub functions for when hotplug is off | 51 | * Stub functions for when hotplug is off |
@@ -30,5 +53,17 @@ void pgdat_resize_init(struct pglist_data *pgdat) | |||
30 | static inline void pgdat_resize_lock(struct pglist_data *p, unsigned long *f) {} | 53 | static inline void pgdat_resize_lock(struct pglist_data *p, unsigned long *f) {} |
31 | static inline void pgdat_resize_unlock(struct pglist_data *p, unsigned long *f) {} | 54 | static inline void pgdat_resize_unlock(struct pglist_data *p, unsigned long *f) {} |
32 | static inline void pgdat_resize_init(struct pglist_data *pgdat) {} | 55 | static inline void pgdat_resize_init(struct pglist_data *pgdat) {} |
33 | #endif | 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 */ | ||
34 | #endif /* __LINUX_MEMORY_HOTPLUG_H */ | 69 | #endif /* __LINUX_MEMORY_HOTPLUG_H */ |