Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01561264 authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar
Browse files

x86: allocate e820 resource struct all together



don't need to allocate that one by one

Signed-off-by: default avatarYinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 272b9cad
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -300,9 +300,10 @@ unsigned long __init e820_end_of_ram(void)
void __init e820_reserve_resources(void)
{
	int i;
	for (i = 0; i < e820.nr_map; i++) {
	struct resource *res;
		res = alloc_bootmem_low(sizeof(struct resource));

	res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map);
	for (i = 0; i < e820.nr_map; i++) {
		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++;
	}
}