* [PATCH] Speed bootmem up for simulators
@ 2002-01-30 23:35 Andi Kleen
0 siblings, 0 replies; only message in thread
From: Andi Kleen @ 2002-01-30 23:35 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel
Hi Linus,
This is a old patch from the x86-64 tree. It just optimizes the final memory
freeing pass to be a bit more efficient. It probably doesn't make much
difference on any CPU, but it is a big time win in a slow CPU simulator
with huge memory where the freeing can take minutes sometimes.
It is just an obvious optimization for the freeing loop.
Patch against 2.5.3. Please apply.
Thanks,
-Andi
--- linux-2.5.3-work/mm/bootmem.c-BOOTMEM Tue Jan 15 17:53:36 2002
+++ linux-2.5.3-work/mm/bootmem.c Wed Jan 30 23:21:35 2002
@@ -247,19 +247,30 @@
bootmem_data_t *bdata = pgdat->bdata;
unsigned long i, count, total = 0;
unsigned long idx;
+ unsigned long *map;
if (!bdata->node_bootmem_map) BUG();
count = 0;
idx = bdata->node_low_pfn - (bdata->node_boot_start >> PAGE_SHIFT);
- for (i = 0; i < idx; i++, page++) {
- if (!test_bit(i, bdata->node_bootmem_map)) {
+ map = bdata->node_bootmem_map;
+ for (i = 0; i < idx; ) {
+ unsigned long v = ~map[i / BITS_PER_LONG];
+ if (v) {
+ unsigned long m;
+ for (m = 1; m && i < idx; m<<=1, page++, i++) {
+ if (v & m) {
count++;
ClearPageReserved(page);
set_page_count(page, 1);
__free_page(page);
}
}
+ } else {
+ i+=BITS_PER_LONG;
+ page+=BITS_PER_LONG;
+ }
+ }
total += count;
/*
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-01-30 23:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-30 23:35 [PATCH] Speed bootmem up for simulators Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox