public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86_64: allcate e820 resource struct all together
@ 2008-03-21  6:57 Yinghai Lu
  2008-03-21 12:04 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Yinghai Lu @ 2008-03-21  6:57 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar; +Cc: kernel list


don't need to allocate that one by one

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.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++;
 	}
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86_64: allcate e820 resource struct all together
  2008-03-21  6:57 [PATCH] x86_64: allcate e820 resource struct all together Yinghai Lu
@ 2008-03-21 12:04 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-03-21 12:04 UTC (permalink / raw)
  To: yhlu.kernel; +Cc: Andrew Morton, kernel list


* Yinghai Lu <yhlu.kernel.send@gmail.com> wrote:

> don't need to allocate that one by one

> +	struct resource *res;
> +	res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map);

nice one - applied.

(minor style nit: please keep a newline between variable definitions and 
the first line of code, to make it a bit more readable.)

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-21 12:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-21  6:57 [PATCH] x86_64: allcate e820 resource struct all together Yinghai Lu
2008-03-21 12:04 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox