x86: allocate e820 resource struct all together
authorYinghai Lu <yhlu.kernel.send@gmail.com>
Fri, 21 Mar 2008 06:57:21 +0000 (23:57 -0700)
committerIngo Molnar <mingo@elte.hu>
Thu, 17 Apr 2008 15:41:19 +0000 (17:41 +0200)
don't need to allocate that one by one

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/e820_64.c

index 4509757844eb14a370fbb219837f4361ceea027d..9184e6437c4f1c5904eb5c5f876e8eebf76d6b84 100644 (file)
@@ -300,9 +300,10 @@ unsigned long __init e820_end_of_ram(void)
 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;
@@ -313,6 +314,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++;
        }
 }