aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memory_hotplug.h
diff options
context:
space:
mode:
authorDave Hansen <haveblue@us.ibm.com>2005-10-29 21:16:53 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 00:40:44 -0400
commitbdc8cb984576ab5b550c8b24c6fa111a873503e3 (patch)
treef94548988874caa10d770e6e65bc50c925abf825 /include/linux/memory_hotplug.h
parent208d54e5513c0c02d85af0990901354c74364d5c (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.h39
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)
16static inline 16static inline
17void pgdat_resize_unlock(struct pglist_data *pgdat, unsigned long *flags) 17void 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}
21static inline 21static inline
22void pgdat_resize_init(struct pglist_data *pgdat) 22void 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 */
29static inline unsigned zone_span_seqbegin(struct zone *zone)
30{
31 return read_seqbegin(&zone->span_seqlock);
32}
33static inline int zone_span_seqretry(struct zone *zone, unsigned iv)
34{
35 return read_seqretry(&zone->span_seqlock, iv);
36}
37static inline void zone_span_writelock(struct zone *zone)
38{
39 write_seqlock(&zone->span_seqlock);
40}
41static inline void zone_span_writeunlock(struct zone *zone)
42{
43 write_sequnlock(&zone->span_seqlock);
44}
45static 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)
30static inline void pgdat_resize_lock(struct pglist_data *p, unsigned long *f) {} 53static inline void pgdat_resize_lock(struct pglist_data *p, unsigned long *f) {}
31static inline void pgdat_resize_unlock(struct pglist_data *p, unsigned long *f) {} 54static inline void pgdat_resize_unlock(struct pglist_data *p, unsigned long *f) {}
32static inline void pgdat_resize_init(struct pglist_data *pgdat) {} 55static inline void pgdat_resize_init(struct pglist_data *pgdat) {}
33#endif 56
57static inline unsigned zone_span_seqbegin(struct zone *zone)
58{
59 return 0;
60}
61static inline int zone_span_seqretry(struct zone *zone, unsigned iv)
62{
63 return 0;
64}
65static inline void zone_span_writelock(struct zone *zone) {}
66static inline void zone_span_writeunlock(struct zone *zone) {}
67static 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 */