Commit 0c16b441 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] Bootmem speedup

This patch speeds the bootmem freeing up a bit. Not particularly important,
but helps on some slow simulators where the loop can chew up significant
CPU time.
parent 101ed2c8
...@@ -247,19 +247,30 @@ static unsigned long __init free_all_bootmem_core(pg_data_t *pgdat) ...@@ -247,19 +247,30 @@ static unsigned long __init free_all_bootmem_core(pg_data_t *pgdat)
bootmem_data_t *bdata = pgdat->bdata; bootmem_data_t *bdata = pgdat->bdata;
unsigned long i, count, total = 0; unsigned long i, count, total = 0;
unsigned long idx; unsigned long idx;
unsigned long *map;
if (!bdata->node_bootmem_map) BUG(); if (!bdata->node_bootmem_map) BUG();
count = 0; count = 0;
idx = bdata->node_low_pfn - (bdata->node_boot_start >> PAGE_SHIFT); idx = bdata->node_low_pfn - (bdata->node_boot_start >> PAGE_SHIFT);
for (i = 0; i < idx; i++, page++) { map = bdata->node_bootmem_map;
if (!test_bit(i, 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++; count++;
ClearPageReserved(page); ClearPageReserved(page);
set_page_count(page, 1); set_page_count(page, 1);
__free_page(page); __free_page(page);
} }
} }
} else {
i+=BITS_PER_LONG;
page+=BITS_PER_LONG;
}
}
total += count; total += count;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment