mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[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>
This commit is contained in:
parent
208d54e551
commit
bdc8cb9845
3 changed files with 66 additions and 7 deletions
|
@ -16,13 +16,36 @@ void pgdat_resize_lock(struct pglist_data *pgdat, unsigned long *flags)
|
|||
static inline
|
||||
void pgdat_resize_unlock(struct pglist_data *pgdat, unsigned long *flags)
|
||||
{
|
||||
spin_lock_irqrestore(&pgdat->node_size_lock, *flags);
|
||||
spin_unlock_irqrestore(&pgdat->node_size_lock, *flags);
|
||||
}
|
||||
static inline
|
||||
void pgdat_resize_init(struct pglist_data *pgdat)
|
||||
{
|
||||
spin_lock_init(&pgdat->node_size_lock);
|
||||
}
|
||||
/*
|
||||
* Zone resizing functions
|
||||
*/
|
||||
static inline unsigned zone_span_seqbegin(struct zone *zone)
|
||||
{
|
||||
return read_seqbegin(&zone->span_seqlock);
|
||||
}
|
||||
static inline int zone_span_seqretry(struct zone *zone, unsigned iv)
|
||||
{
|
||||
return read_seqretry(&zone->span_seqlock, iv);
|
||||
}
|
||||
static inline void zone_span_writelock(struct zone *zone)
|
||||
{
|
||||
write_seqlock(&zone->span_seqlock);
|
||||
}
|
||||
static inline void zone_span_writeunlock(struct zone *zone)
|
||||
{
|
||||
write_sequnlock(&zone->span_seqlock);
|
||||
}
|
||||
static inline void zone_seqlock_init(struct zone *zone)
|
||||
{
|
||||
seqlock_init(&zone->span_seqlock);
|
||||
}
|
||||
#else /* ! CONFIG_MEMORY_HOTPLUG */
|
||||
/*
|
||||
* Stub functions for when hotplug is off
|
||||
|
@ -30,5 +53,17 @@ void pgdat_resize_init(struct pglist_data *pgdat)
|
|||
static inline void pgdat_resize_lock(struct pglist_data *p, unsigned long *f) {}
|
||||
static inline void pgdat_resize_unlock(struct pglist_data *p, unsigned long *f) {}
|
||||
static inline void pgdat_resize_init(struct pglist_data *pgdat) {}
|
||||
#endif
|
||||
|
||||
static inline unsigned zone_span_seqbegin(struct zone *zone)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int zone_span_seqretry(struct zone *zone, unsigned iv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void zone_span_writelock(struct zone *zone) {}
|
||||
static inline void zone_span_writeunlock(struct zone *zone) {}
|
||||
static inline void zone_seqlock_init(struct zone *zone) {}
|
||||
#endif /* ! CONFIG_MEMORY_HOTPLUG */
|
||||
#endif /* __LINUX_MEMORY_HOTPLUG_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue