remove bitmap operation from free_pages() --- linux-2.6.8.1-kame-kamezawa/mm/page_alloc.c | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff -puN mm/page_alloc.c~eliminate-bitmap-p04 mm/page_alloc.c --- linux-2.6.8.1-kame/mm/page_alloc.c~eliminate-bitmap-p04 2004-08-21 08:55:16.712684136 +0900 +++ linux-2.6.8.1-kame-kamezawa/mm/page_alloc.c 2004-08-21 09:03:32.859258392 +0900 @@ -181,7 +181,7 @@ static void destroy_compound_page(struct static inline void __free_pages_bulk (struct page *page, struct page *base, struct zone *zone, struct free_area *area, unsigned int order) { - unsigned long page_idx, index, mask; + unsigned long page_idx, mask; if (order) destroy_compound_page(page, order); @@ -189,21 +189,21 @@ static inline void __free_pages_bulk (st page_idx = page - base; if (page_idx & ~mask) BUG(); - index = page_idx >> (1 + order); - + set_page_order(page,order); zone->free_pages += 1 << order; while (order < MAX_ORDER-1) { struct page *buddy1, *buddy2; BUG_ON(area >= zone->free_area + MAX_ORDER); - if (!__test_and_change_bit(index, area->map)) - /* - * the buddy page is still allocated. - */ - break; - /* Move the buddy up one level. */ buddy1 = base + (page_idx ^ (1 << order)); + BUG_ON(bad_range(zone, buddy1)); + if ((page_count(buddy1) != 0) || + (page_order(buddy1) != order) ) + /* + * the buddy is still allocated + */ + break; buddy2 = base + page_idx; BUG_ON(bad_range(zone, buddy1)); BUG_ON(bad_range(zone, buddy2)); @@ -211,9 +211,9 @@ static inline void __free_pages_bulk (st mask <<= 1; order++; area++; - index >>= 1; page_idx &= mask; } + set_page_order((base + page_idx), order); list_add(&(base + page_idx)->lru, &area->free_list); } @@ -236,6 +236,7 @@ static inline void free_pages_check(cons bad_page(function, page); if (PageDirty(page)) ClearPageDirty(page); + invalidate_page_order(page); } /* _