aboutsummaryrefslogtreecommitdiffstats
path: root/mm
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 /mm
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 'mm')
-rw-r--r--mm/page_alloc.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 32fad6d23200..817635f2ab62 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -33,6 +33,7 @@
33#include <linux/sysctl.h> 33#include <linux/sysctl.h>
34#include <linux/cpu.h> 34#include <linux/cpu.h>
35#include <linux/cpuset.h> 35#include <linux/cpuset.h>
36#include <linux/memory_hotplug.h>
36#include <linux/nodemask.h> 37#include <linux/nodemask.h>
37#include <linux/vmalloc.h> 38#include <linux/vmalloc.h>
38 39
@@ -80,12 +81,19 @@ unsigned long __initdata nr_all_pages;
80 81
81static int page_outside_zone_boundaries(struct zone *zone, struct page *page) 82static int page_outside_zone_boundaries(struct zone *zone, struct page *page)
82{ 83{
83 if (page_to_pfn(page) >= zone->zone_start_pfn + zone->spanned_pages) 84 int ret = 0;
84 return 1; 85 unsigned seq;
85 if (page_to_pfn(page) < zone->zone_start_pfn) 86 unsigned long pfn = page_to_pfn(page);
86 return 1;
87 87
88 return 0; 88 do {
89 seq = zone_span_seqbegin(zone);
90 if (pfn >= zone->zone_start_pfn + zone->spanned_pages)
91 ret = 1;
92 else if (pfn < zone->zone_start_pfn)
93 ret = 1;
94 } while (zone_span_seqretry(zone, seq));
95
96 return ret;
89} 97}
90 98
91static int page_is_consistent(struct zone *zone, struct page *page) 99static int page_is_consistent(struct zone *zone, struct page *page)
@@ -1980,6 +1988,7 @@ static void __init free_area_init_core(struct pglist_data *pgdat,
1980 zone->name = zone_names[j]; 1988 zone->name = zone_names[j];
1981 spin_lock_init(&zone->lock); 1989 spin_lock_init(&zone->lock);
1982 spin_lock_init(&zone->lru_lock); 1990 spin_lock_init(&zone->lru_lock);
1991 zone_seqlock_init(zone);
1983 zone->zone_pgdat = pgdat; 1992 zone->zone_pgdat = pgdat;
1984 zone->free_pages = 0; 1993 zone->free_pages = 0;
1985 1994