Commit f6adf918 authored by William Lee Irwin III's avatar William Lee Irwin III Committed by Linus Torvalds

[PATCH] Re: convert BAD_RANGE() to an inline function

parent 9a89d96d
...@@ -44,14 +44,18 @@ static int zone_balance_min[MAX_NR_ZONES] __initdata = { 20 , 20, 20, }; ...@@ -44,14 +44,18 @@ static int zone_balance_min[MAX_NR_ZONES] __initdata = { 20 , 20, 20, };
static int zone_balance_max[MAX_NR_ZONES] __initdata = { 255 , 255, 255, }; static int zone_balance_max[MAX_NR_ZONES] __initdata = { 255 , 255, 255, };
/* /*
* Temporary debugging check. * Temporary debugging check for pages not lying within a given zone.
*/ */
#define BAD_RANGE(zone, page) \ static inline int bad_range(zone_t *zone, struct page *page)
( \ {
(((page) - mem_map) >= ((zone)->zone_start_mapnr+(zone)->size)) \ if (page - mem_map >= zone->zone_start_mapnr + zone->size)
|| (((page) - mem_map) < (zone)->zone_start_mapnr) \ return 1;
|| ((zone) != page_zone(page)) \ if (page - mem_map < zone->zone_start_mapnr)
) return 1;
if (zone != page_zone(page))
return 1;
return 0;
}
/* /*
* Freeing function for a buddy system allocator. * Freeing function for a buddy system allocator.
...@@ -135,9 +139,9 @@ static void __free_pages_ok (struct page *page, unsigned int order) ...@@ -135,9 +139,9 @@ static void __free_pages_ok (struct page *page, unsigned int order)
*/ */
buddy1 = base + (page_idx ^ -mask); buddy1 = base + (page_idx ^ -mask);
buddy2 = base + page_idx; buddy2 = base + page_idx;
if (BAD_RANGE(zone,buddy1)) if (bad_range(zone, buddy1))
BUG(); BUG();
if (BAD_RANGE(zone,buddy2)) if (bad_range(zone, buddy2))
BUG(); BUG();
list_del(&buddy1->list); list_del(&buddy1->list);
...@@ -171,7 +175,7 @@ static inline struct page * expand (zone_t *zone, struct page *page, ...@@ -171,7 +175,7 @@ static inline struct page * expand (zone_t *zone, struct page *page,
unsigned long size = 1 << high; unsigned long size = 1 << high;
while (high > low) { while (high > low) {
if (BAD_RANGE(zone,page)) if (bad_range(zone, page))
BUG(); BUG();
area--; area--;
high--; high--;
...@@ -181,7 +185,7 @@ static inline struct page * expand (zone_t *zone, struct page *page, ...@@ -181,7 +185,7 @@ static inline struct page * expand (zone_t *zone, struct page *page,
index += size; index += size;
page += size; page += size;
} }
if (BAD_RANGE(zone,page)) if (bad_range(zone, page))
BUG(); BUG();
return page; return page;
} }
...@@ -204,7 +208,7 @@ static struct page * rmqueue(zone_t *zone, unsigned int order) ...@@ -204,7 +208,7 @@ static struct page * rmqueue(zone_t *zone, unsigned int order)
unsigned int index; unsigned int index;
page = list_entry(curr, struct page, list); page = list_entry(curr, struct page, list);
if (BAD_RANGE(zone,page)) if (bad_range(zone, page))
BUG(); BUG();
list_del(curr); list_del(curr);
index = page - zone->zone_mem_map; index = page - zone->zone_mem_map;
...@@ -216,7 +220,7 @@ static struct page * rmqueue(zone_t *zone, unsigned int order) ...@@ -216,7 +220,7 @@ static struct page * rmqueue(zone_t *zone, unsigned int order)
spin_unlock_irqrestore(&zone->lock, flags); spin_unlock_irqrestore(&zone->lock, flags);
set_page_count(page, 1); set_page_count(page, 1);
if (BAD_RANGE(zone,page)) if (bad_range(zone, page))
BUG(); BUG();
if (PageLRU(page)) if (PageLRU(page))
BUG(); BUG();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment