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

[PATCH] remove macros from page_alloc.c

  The memlist_* macros serve as nothing but an insulation layer from the
  Linux-native generic list operations. This patch removes them in favor
  of using generic list operations directly.
parent 5a556f26
...@@ -43,14 +43,6 @@ static int zone_balance_ratio[MAX_NR_ZONES] __initdata = { 128, 128, 128, }; ...@@ -43,14 +43,6 @@ static int zone_balance_ratio[MAX_NR_ZONES] __initdata = { 128, 128, 128, };
static int zone_balance_min[MAX_NR_ZONES] __initdata = { 20 , 20, 20, }; 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, };
#define memlist_init(x) INIT_LIST_HEAD(x)
#define memlist_add_head list_add
#define memlist_add_tail list_add_tail
#define memlist_del list_del
#define memlist_entry list_entry
#define memlist_next(x) ((x)->next)
#define memlist_prev(x) ((x)->prev)
/* /*
* Temporary debugging check. * Temporary debugging check.
*/ */
...@@ -145,13 +137,13 @@ static void __free_pages_ok (struct page *page, unsigned int order) ...@@ -145,13 +137,13 @@ static void __free_pages_ok (struct page *page, unsigned int order)
if (BAD_RANGE(zone,buddy2)) if (BAD_RANGE(zone,buddy2))
BUG(); BUG();
memlist_del(&buddy1->list); list_del(&buddy1->list);
mask <<= 1; mask <<= 1;
area++; area++;
index >>= 1; index >>= 1;
page_idx &= mask; page_idx &= mask;
} }
memlist_add_head(&(base + page_idx)->list, &area->free_list); list_add(&(base + page_idx)->list, &area->free_list);
spin_unlock_irqrestore(&zone->lock, flags); spin_unlock_irqrestore(&zone->lock, flags);
return; return;
...@@ -181,7 +173,7 @@ static inline struct page * expand (zone_t *zone, struct page *page, ...@@ -181,7 +173,7 @@ static inline struct page * expand (zone_t *zone, struct page *page,
area--; area--;
high--; high--;
size >>= 1; size >>= 1;
memlist_add_head(&(page)->list, &(area)->free_list); list_add(&(page)->list, &(area)->free_list);
MARK_USED(index, high, area); MARK_USED(index, high, area);
index += size; index += size;
page += size; page += size;
...@@ -203,15 +195,15 @@ static struct page * rmqueue(zone_t *zone, unsigned int order) ...@@ -203,15 +195,15 @@ static struct page * rmqueue(zone_t *zone, unsigned int order)
spin_lock_irqsave(&zone->lock, flags); spin_lock_irqsave(&zone->lock, flags);
do { do {
head = &area->free_list; head = &area->free_list;
curr = memlist_next(head); curr = head->next;
if (curr != head) { if (curr != head) {
unsigned int index; unsigned int index;
page = memlist_entry(curr, struct page, list); page = list_entry(curr, struct page, list);
if (BAD_RANGE(zone,page)) if (BAD_RANGE(zone,page))
BUG(); BUG();
memlist_del(curr); list_del(curr);
index = page - zone->zone_mem_map; index = page - zone->zone_mem_map;
if (curr_order != MAX_ORDER-1) if (curr_order != MAX_ORDER-1)
MARK_USED(index, curr_order, area); MARK_USED(index, curr_order, area);
...@@ -673,7 +665,7 @@ void show_free_areas_core(pg_data_t *pgdat) ...@@ -673,7 +665,7 @@ void show_free_areas_core(pg_data_t *pgdat)
curr = head; curr = head;
nr = 0; nr = 0;
for (;;) { for (;;) {
curr = memlist_next(curr); curr = curr->next;
if (curr == head) if (curr == head)
break; break;
nr++; nr++;
...@@ -903,7 +895,7 @@ void __init free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap, ...@@ -903,7 +895,7 @@ void __init free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap,
set_page_zone(page, nid * MAX_NR_ZONES + j); set_page_zone(page, nid * MAX_NR_ZONES + j);
set_page_count(page, 0); set_page_count(page, 0);
SetPageReserved(page); SetPageReserved(page);
memlist_init(&page->list); INIT_LIST_HEAD(&page->list);
if (j != ZONE_HIGHMEM) if (j != ZONE_HIGHMEM)
set_page_address(page, __va(zone_start_paddr)); set_page_address(page, __va(zone_start_paddr));
zone_start_paddr += PAGE_SIZE; zone_start_paddr += PAGE_SIZE;
...@@ -913,7 +905,7 @@ void __init free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap, ...@@ -913,7 +905,7 @@ void __init free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap,
for (i = 0; ; i++) { for (i = 0; ; i++) {
unsigned long bitmap_size; unsigned long bitmap_size;
memlist_init(&zone->free_area[i].free_list); INIT_LIST_HEAD(&zone->free_area[i].free_list);
if (i == MAX_ORDER-1) { if (i == MAX_ORDER-1) {
zone->free_area[i].map = NULL; zone->free_area[i].map = NULL;
break; break;
......
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