[patch 2/2] bootmem: Node-setup agnostic free_bootmem()

From: Johannes Weiner
Date: Sun Apr 13 2008 - 06:36:53 EST


Make free_bootmem() look up the node holding the specified address
range which lets it work transparently on single-node and multi-node
configurations.

Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxxx>
CC: Yinghai Lu <yhlu.kernel@xxxxxxxxx>
CC: Andi Kleen <ak@xxxxxxx>
CC: Yasunori Goto <y-goto@xxxxxxxxxxxxxx>
CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
CC: Ingo Molnar <mingo@xxxxxxx>
CC: Christoph Lameter <clameter@xxxxxxx>
CC: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

Patch tested on x86_32 uma.

Index: linux-2.6/mm/bootmem.c
===================================================================
--- linux-2.6.orig/mm/bootmem.c
+++ linux-2.6/mm/bootmem.c
@@ -421,7 +421,15 @@ int __init reserve_bootmem(unsigned long

void __init free_bootmem(unsigned long addr, unsigned long size)
{
- free_bootmem_core(NODE_DATA(0)->bdata, addr, size);
+ bootmem_data_t *bdata;
+
+ list_for_each_entry (bdata, &bdata_list, list) {
+ if (addr < bdata->node_boot_start)
+ continue;
+ free_bootmem_core(bdata, addr, size);
+ return;
+ }
+ BUG();
}

unsigned long __init free_all_bootmem(void)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/