linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC] free_area[] bitmap elimination [3/3]
@ 2004-08-21  2:39 Hiroyuki KAMEZAWA
  0 siblings, 0 replies; only message in thread
From: Hiroyuki KAMEZAWA @ 2004-08-21  2:39 UTC (permalink / raw)
  To: linux-mm; +Cc: LHMS

[-- Attachment #1: Type: text/plain, Size: 146 bytes --]

This part is for free_pages().





-- 
--the clue is these footmarks leading to the door.--
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>



[-- Attachment #2: eliminate-bitmap-p04.patch --]
[-- Type: text/x-patch, Size: 2006 bytes --]


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);
 }
 
 /*

_

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-08-21  2:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-21  2:39 [RFC] free_area[] bitmap elimination [3/3] Hiroyuki KAMEZAWA

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox