linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hiroyuki KAMEZAWA <kamezawa.hiroyu@jp.fujitsu.com>
To: linux-mm <linux-mm@kvack.org>
Cc: LHMS <lhms-devel@lists.sourceforge.net>
Subject: [RFC] free_area[] bitmap elimination [3/3]
Date: Sat, 21 Aug 2004 11:39:43 +0900	[thread overview]
Message-ID: <4126B5EF.2090701@jp.fujitsu.com> (raw)

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

_

                 reply	other threads:[~2004-08-21  2:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4126B5EF.2090701@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=lhms-devel@lists.sourceforge.net \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox