public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] mm: cleanup bootmem
@ 2006-01-14 12:42 Nick Piggin
  2006-01-14 12:47 ` Nick Piggin
  2006-01-14 17:50 ` Linus Torvalds
  0 siblings, 2 replies; 9+ messages in thread
From: Nick Piggin @ 2006-01-14 12:42 UTC (permalink / raw)
  To: Andrew Morton, David Howells; +Cc: Linus Torvalds, Linux Kernel Mailing List

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

Objections?

-- 
SUSE Labs, Novell Inc.


[-- Attachment #2: mm-cleanup-bootmem.patch --]
[-- Type: text/plain, Size: 1761 bytes --]

The bootmem code added to page_alloc.c duplicated some page freeing code
that it really doesn't need to because it is not so performance critical.

While we're here, make prefetching work properly by actually prefetching
the page we're about to use before prefetching ahead to the next one (ie.
get the most important transaction started first). Also prefetch just a
single page ahead rather than leaving a gap of 16.

Signed-off-by: Nick Piggin <npiggin@suse.de>

Index: linux-2.6/mm/page_alloc.c
===================================================================
--- linux-2.6.orig/mm/page_alloc.c
+++ linux-2.6/mm/page_alloc.c
@@ -55,8 +55,6 @@ unsigned long totalhigh_pages __read_mos
 long nr_swap_pages;
 int percpu_pagelist_fraction;
 
-static void fastcall free_hot_cold_page(struct page *page, int cold);
-
 /*
  * results with 256, 32 in the lowmem_reserve sysctl:
  *	1G machine -> (16M dma, 800M-16M normal, 1G-800M high)
@@ -444,28 +442,23 @@ void fastcall __init __free_pages_bootme
 	if (order == 0) {
 		__ClearPageReserved(page);
 		set_page_count(page, 0);
-
-		free_hot_cold_page(page, 0);
+		set_page_refs(page, 0);
+		__free_page(page);
 	} else {
-		LIST_HEAD(list);
 		int loop;
 
+		prefetchw(page);
 		for (loop = 0; loop < BITS_PER_LONG; loop++) {
 			struct page *p = &page[loop];
 
-			if (loop + 16 < BITS_PER_LONG)
-				prefetchw(p + 16);
+			if (loop + 1 < BITS_PER_LONG)
+				prefetchw(p + 1);
 			__ClearPageReserved(p);
 			set_page_count(p, 0);
 		}
 
-		arch_free_page(page, order);
-
-		mod_page_state(pgfree, 1 << order);
-
-		list_add(&page->lru, &list);
-		kernel_map_pages(page, 1 << order, 0);
-		free_pages_bulk(page_zone(page), 1, &list, order);
+		set_page_refs(page, order);
+		__free_pages(page, order);
 	}
 }
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-01-16 15:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-14 12:42 [patch] mm: cleanup bootmem Nick Piggin
2006-01-14 12:47 ` Nick Piggin
2006-01-14 17:50 ` Linus Torvalds
2006-01-14 18:02   ` Nick Piggin
2006-01-14 18:06     ` Nick Piggin
2006-01-14 18:13       ` Linus Torvalds
2006-01-14 18:43         ` Nick Piggin
2006-01-16  8:53         ` Jes Sorensen
2006-01-16 15:25           ` Jack Steiner

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