aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorDave Hansen <haveblue@us.ibm.com>2005-10-29 21:16:52 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 00:40:44 -0400
commitc6a57e19e464db118dc4ab9cfe9e9748c6d630a0 (patch)
tree1be192e4c0635c9aa49c8c76d1606e606ecdc9a0 /mm
parent4ca644d970bf2542623228a4624af356d20ca267 (diff)
[PATCH] memory hotplug prep: fixup bad_range()
When doing memory hotplug operations, the size of existing zones can obviously change. This means that zone->zone_{start_pfn,spanned_pages} can change. There are currently no locks that protect these structure members. However, they are rarely accessed at runtime. Outside of swsusp, the only place that I can find is bad_range(). So, split bad_range() up into two pieces: one that needs to be locked and anther that doesn't. 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.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 9a2fa8110afc..a51ef94eec33 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -78,21 +78,37 @@ int min_free_kbytes = 1024;
78unsigned long __initdata nr_kernel_pages; 78unsigned long __initdata nr_kernel_pages;
79unsigned long __initdata nr_all_pages; 79unsigned long __initdata nr_all_pages;
80 80
81/* 81static int page_outside_zone_boundaries(struct zone *zone, struct page *page)
82 * Temporary debugging check for pages not lying within a given zone.
83 */
84static int bad_range(struct zone *zone, struct page *page)
85{ 82{
86 if (page_to_pfn(page) >= zone->zone_start_pfn + zone->spanned_pages) 83 if (page_to_pfn(page) >= zone->zone_start_pfn + zone->spanned_pages)
87 return 1; 84 return 1;
88 if (page_to_pfn(page) < zone->zone_start_pfn) 85 if (page_to_pfn(page) < zone->zone_start_pfn)
89 return 1; 86 return 1;
87
88 return 0;
89}
90
91static int page_is_consistent(struct zone *zone, struct page *page)
92{
90#ifdef CONFIG_HOLES_IN_ZONE 93#ifdef CONFIG_HOLES_IN_ZONE
91 if (!pfn_valid(page_to_pfn(page))) 94 if (!pfn_valid(page_to_pfn(page)))
92 return 1; 95 return 0;
93#endif 96#endif
94 if (zone != page_zone(page)) 97 if (zone != page_zone(page))
98 return 0;
99
100 return 1;
101}
102/*
103 * Temporary debugging check for pages not lying within a given zone.
104 */
105static int bad_range(struct zone *zone, struct page *page)
106{
107 if (page_outside_zone_boundaries(zone, page))
95 return 1; 108 return 1;
109 if (!page_is_consistent(zone, page))
110 return 1;
111
96 return 0; 112 return 0;
97} 113}
98 114