Skip to contentSkip to conversation

mm: cleanup bootmem

PATCH In review Nick Piggin 4 participants 9 messages Jan 14, 2006 – Jan 16, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: cleanup bootmem

Objections?

Signature · 1 line
SUSE Labs, Novell Inc.

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.

mm/page_alloc.c +7 -14
Index: 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);
 	}
 }
 
#1 lore raw
Quoted 8 lines · Nick Piggin

Objections?

------------------------------------------------------------------------

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.

... but actually it is possible that it ends up being faster with this patch anyway, due to the old code freeing the pages as higher order
batches: they won't have to go through as many iterations in the buddy allocator. This patch restores that behaviour as well.

Signature · 3 lines
SUSE Labs, Novell Inc.

Send instant messages to your online friends http://au.messenger.yahoo.com 
#2 lore raw
In reply to Nick Piggin
Quoted 2 lines · Nick Piggin

Objections?

The whole point of the pre-batching was that apparently the non-batched bootmem code took ages to boot in simulation with lots of memory. I think it was the ia64 people who used simulation a lot. So..

Linus

#3 lore raw
Quoted 10 lines · Linus Torvalds
Quoted 1 line · Nick Piggin

Objections?

The whole point of the pre-batching was that apparently the non-batched bootmem code took ages to boot in simulation with lots of memory. I think it was the ia64 people who used simulation a lot. So..

Linus

Changelog doesn't mention it: a226f6c899799fe2c4919daa0767ac579c88f7bd

Or... what do you mean by pre-batching? (maybe I'm confused and you're talking about my prefetching change or something)

Signature · 3 lines
SUSE Labs, Novell Inc.

Send instant messages to your online friends http://au.messenger.yahoo.com 
#4 lore raw
Quoted 11 lines · Nick Piggin
Quoted 9 lines · Linus Torvalds
Quoted 1 line · Nick Piggin

Objections?

The whole point of the pre-batching was that apparently the non-batched bootmem code took ages to boot in simulation with lots of memory. I think it was the ia64 people who used simulation a lot. So..

Quoted 8 lines
Quoted 2 lines

Linus

Changelog doesn't mention it: a226f6c899799fe2c4919daa0767ac579c88f7bd

Or... what do you mean by pre-batching? (maybe I'm confused and you're talking about my prefetching change or something)

Oh the BITS_PER_LONG batching? That's still completely functional after my patch. In fact, as I said in a followup it is likely to work better than with David's change to free batched pages as order-0, because I reverted back to freeing them as higher order pages.

Signature · 3 lines
SUSE Labs, Novell Inc.

Send instant messages to your online friends http://au.messenger.yahoo.com 
#5 lore raw
Quoted 2 lines · Nick Piggin

Oh the BITS_PER_LONG batching?

Yes.

Quoted 4 lines

That's still completely functional after
my patch. In fact, as I said in a followup it is likely to work better than with David's change to free batched pages as order-0, because I reverted back to freeing them as higher order pages.

Ok. Then I doubt anybody will complain. I'm still wondering if some of the other ugliness was due to some simulator strangeness issues, but maybe even ia64 doesn't care that much any more..

Linus

#6 lore raw
Quoted 9 lines · Linus Torvalds
Quoted 1 line · Nick Piggin

Oh the BITS_PER_LONG batching?

Yes.

Quoted 7 lines
Quoted 4 lines

That's still completely functional after
my patch. In fact, as I said in a followup it is likely to work better than with David's change to free batched pages as order-0, because I reverted back to freeing them as higher order pages.

Ok. Then I doubt anybody will complain. I'm still wondering if some of the other ugliness was due to some simulator strangeness issues, but maybe

I'm a little unsure. That's what I suspected when I saw David's changeset was part of an FRV: prefixed batch but wasn't directly related to FRV code. (ie. normally such a patch would be mm: or bootmem:)

Signature · 3 lines
SUSE Labs, Novell Inc.

Send instant messages to your online friends http://au.messenger.yahoo.com 
#7 lore raw
In reply to Linus Torvalds
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Linus" == Linus Torvalds <[email protected]> writes:

Quoted 4 lines · Nick Piggin
Quoted 4 lines

That's still completely functional after my patch. In fact, as I said in a followup it is likely to work better than with David's change to free batched pages as order-0, because I reverted back to freeing them as higher order pages.

Linus> Ok. Then I doubt anybody will complain. I'm still wondering if Linus> some of the other ugliness was due to some simulator Linus> strangeness issues, but maybe even ia64 doesn't care that much Linus> any more..

We still use simulators for a bunch of stuff, but I don't know if this is affecting it or not. Jack Steiner may know more.

Cheers,
Jes

#8 lore raw
Quoted 8 lines · Jes Sorensen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Linus" == Linus Torvalds <[email protected]> writes:

Quoted 4 lines · Nick Piggin
Quoted 4 lines

That's still completely functional after my patch. In fact, as I said in a followup it is likely to work better than with David's change to free batched pages as order-0, because I reverted back to freeing them as higher order pages.

Quoted 7 lines

Linus> Ok. Then I doubt anybody will complain. I'm still wondering if Linus> some of the other ugliness was due to some simulator Linus> strangeness issues, but maybe even ia64 doesn't care that much Linus> any more..

We still use simulators for a bunch of stuff, but I don't know if this is affecting it or not. Jack Steiner may know more.

AFAICT, the patch doesnt affect the simulator that is used at SGI. I built a current tree, applied the patch & booted ok. No problems.

Quoted 3 lines

Cheers,
Jes

--
Thanks

Jack