[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <200803202357.22045.yhlu.kernel@gmail.com>
Date: Thu, 20 Mar 2008 23:57:21 -0700
From: Yinghai Lu <yhlu.kernel.send@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...e.hu>
Cc: kernel list <linux-kernel@...r.kernel.org>
Subject: [PATCH] x86_64: allcate e820 resource struct all together
don't need to allocate that one by one
Signed-off-by: Yinghai Lu <yhlu.kernel@...il.com>
Index: linux-2.6/arch/x86/kernel/e820_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820_64.c
+++ linux-2.6/arch/x86/kernel/e820_64.c
@@ -237,9 +237,9 @@ unsigned long __init e820_end_of_ram(voi
void __init e820_reserve_resources(void)
{
int i;
+ struct resource *res;
+ res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map);
for (i = 0; i < e820.nr_map; i++) {
- struct resource *res;
- res = alloc_bootmem_low(sizeof(struct resource));
switch (e820.map[i].type) {
case E820_RAM: res->name = "System RAM"; break;
case E820_ACPI: res->name = "ACPI Tables"; break;
@@ -250,6 +250,7 @@ void __init e820_reserve_resources(void)
res->end = res->start + e820.map[i].size - 1;
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
insert_resource(&iomem_resource, res);
+ res++;
}
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists