public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] don't use alloc_bootmem_low() where not strictly needed
@ 2009-06-30 11:20 Jan Beulich
  2009-06-30 22:03 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2009-06-30 11:20 UTC (permalink / raw)
  To: Ingo Molnar, bernhard.walle, Thomas Gleixner, hpa; +Cc: linux-kernel

Since alloc_bootmem() will never return inaccessible (via virtual
addressing) memory anyway, using the ..._low() variant only makes sense
when the physical address range of the allocated memory must fulfill
further constraints, espacially since on 64-bits (or more generally in
all cases where the pools the two variants allocate from are
different), the space available for ..._low() is more easily exhausted 
than the full available range.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

---
 arch/x86/kernel/e820.c    |    2 +-
 arch/x86/mm/init_32.c     |    4 ++--
 drivers/firmware/memmap.c |    2 +-
 kernel/power/snapshot.c   |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

--- linux-2.6.31-rc1/arch/x86/kernel/e820.c	2009-06-26 17:49:43.000000000 +0200
+++ 2.6.31-rc1-avoid-alloc_bootmem_low/arch/x86/kernel/e820.c	2009-05-06 11:35:49.000000000 +0200
@@ -1332,7 +1332,7 @@ void __init e820_reserve_resources(void)
 	struct resource *res;
 	u64 end;
 
-	res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map);
+	res = alloc_bootmem(sizeof(struct resource) * e820.nr_map);
 	e820_res = res;
 	for (i = 0; i < e820.nr_map; i++) {
 		end = e820.map[i].addr + e820.map[i].size - 1;
--- linux-2.6.31-rc1/arch/x86/mm/init_32.c	2009-06-26 17:49:43.000000000 +0200
+++ 2.6.31-rc1-avoid-alloc_bootmem_low/arch/x86/mm/init_32.c	2009-04-27 12:30:18.000000000 +0200
@@ -84,7 +84,7 @@ static pmd_t * __init one_md_table_init(
 #ifdef CONFIG_X86_PAE
 	if (!(pgd_val(*pgd) & _PAGE_PRESENT)) {
 		if (after_bootmem)
-			pmd_table = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE);
+			pmd_table = (pmd_t *)alloc_bootmem_pages(PAGE_SIZE);
 		else
 			pmd_table = (pmd_t *)alloc_low_page();
 		paravirt_alloc_pmd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT);
@@ -116,7 +116,7 @@ static pte_t * __init one_page_table_ini
 #endif
 			if (!page_table)
 				page_table =
-				(pte_t *)alloc_bootmem_low_pages(PAGE_SIZE);
+				(pte_t *)alloc_bootmem_pages(PAGE_SIZE);
 		} else
 			page_table = (pte_t *)alloc_low_page();
 
--- linux-2.6.31-rc1/drivers/firmware/memmap.c	2009-06-26 17:49:44.000000000 +0200
+++ 2.6.31-rc1-avoid-alloc_bootmem_low/drivers/firmware/memmap.c	2009-04-27 12:29:07.000000000 +0200
@@ -164,7 +164,7 @@ int __init firmware_map_add_early(u64 st
 {
 	struct firmware_map_entry *entry;
 
-	entry = alloc_bootmem_low(sizeof(struct firmware_map_entry));
+	entry = alloc_bootmem(sizeof(struct firmware_map_entry));
 	if (WARN_ON(!entry))
 		return -ENOMEM;
 




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

* Re: [PATCH] don't use alloc_bootmem_low() where not strictly needed
  2009-06-30 11:20 [PATCH] don't use alloc_bootmem_low() where not strictly needed Jan Beulich
@ 2009-06-30 22:03 ` Ingo Molnar
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2009-06-30 22:03 UTC (permalink / raw)
  To: Jan Beulich; +Cc: bernhard.walle, Thomas Gleixner, hpa, linux-kernel


* Jan Beulich <JBeulich@novell.com> wrote:

> Since alloc_bootmem() will never return inaccessible (via virtual 
> addressing) memory anyway, using the ..._low() variant only makes 
> sense when the physical address range of the allocated memory must 
> fulfill further constraints, espacially since on 64-bits (or more 
> generally in all cases where the pools the two variants allocate 
> from are different), the space available for ..._low() is more 
> easily exhausted than the full available range.

hm, i have some vague memories of the _low() being relevant for 
things like PAGEALLOC stability. Thomas, do you remember anything 
specific there?

	Ingo

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

* [PATCH] don't use alloc_bootmem_low() where not strictly needed
@ 2009-08-18 15:54 Jan Beulich
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2009-08-18 15:54 UTC (permalink / raw)
  To: mingo, tglx, hpa; +Cc: linux-kernel

Since alloc_bootmem() will never return inaccessible (via virtual
addressing) memory anyway, using the ..._low() variant only makes sense
when the physical address range of the allocated memory must fulfill
further constraints, espacially since on 64-bits (or more generally in
all cases where the pools the two variants allocate from are
different), the space available for ..._low() is more easily exhausted 
than the full available range.

Probably the use in alloc_tce_table() could also be eliminated (based
on code inspection of pci-calgary_64.c), but that seems too risky given
I know nothing about that hardware and have no way to test it.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

---
 arch/x86/kernel/e820.c    |    2 +-
 arch/x86/mm/init_32.c     |    4 ++--
 drivers/firmware/memmap.c |    2 +-
 kernel/power/snapshot.c   |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

--- linux-2.6.31-rc6/arch/x86/kernel/e820.c	2009-08-18 15:31:16.000000000 +0200
+++ 2.6.31-rc6-avoid-alloc_bootmem_low/arch/x86/kernel/e820.c	2009-07-29 12:58:44.000000000 +0200
@@ -1331,7 +1331,7 @@ void __init e820_reserve_resources(void)
 	struct resource *res;
 	u64 end;
 
-	res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map);
+	res = alloc_bootmem(sizeof(struct resource) * e820.nr_map);
 	e820_res = res;
 	for (i = 0; i < e820.nr_map; i++) {
 		end = e820.map[i].addr + e820.map[i].size - 1;
--- linux-2.6.31-rc6/arch/x86/mm/init_32.c	2009-08-18 15:31:16.000000000 +0200
+++ 2.6.31-rc6-avoid-alloc_bootmem_low/arch/x86/mm/init_32.c	2009-07-29 12:58:44.000000000 +0200
@@ -84,7 +84,7 @@ static pmd_t * __init one_md_table_init(
 #ifdef CONFIG_X86_PAE
 	if (!(pgd_val(*pgd) & _PAGE_PRESENT)) {
 		if (after_bootmem)
-			pmd_table = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE);
+			pmd_table = (pmd_t *)alloc_bootmem_pages(PAGE_SIZE);
 		else
 			pmd_table = (pmd_t *)alloc_low_page();
 		paravirt_alloc_pmd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT);
@@ -116,7 +116,7 @@ static pte_t * __init one_page_table_ini
 #endif
 			if (!page_table)
 				page_table =
-				(pte_t *)alloc_bootmem_low_pages(PAGE_SIZE);
+				(pte_t *)alloc_bootmem_pages(PAGE_SIZE);
 		} else
 			page_table = (pte_t *)alloc_low_page();
 
--- linux-2.6.31-rc6/drivers/firmware/memmap.c	2009-08-18 15:31:18.000000000 +0200
+++ 2.6.31-rc6-avoid-alloc_bootmem_low/drivers/firmware/memmap.c	2009-07-29 12:58:44.000000000 +0200
@@ -164,7 +164,7 @@ int __init firmware_map_add_early(u64 st
 {
 	struct firmware_map_entry *entry;
 
-	entry = alloc_bootmem_low(sizeof(struct firmware_map_entry));
+	entry = alloc_bootmem(sizeof(struct firmware_map_entry));
 	if (WARN_ON(!entry))
 		return -ENOMEM;
 
--- linux-2.6.31-rc6/kernel/power/snapshot.c	2009-08-18 15:31:56.000000000 +0200
+++ 2.6.31-rc6-avoid-alloc_bootmem_low/kernel/power/snapshot.c	2009-07-29 12:58:44.000000000 +0200
@@ -619,7 +619,7 @@ __register_nosave_region(unsigned long s
 		BUG_ON(!region);
 	} else
 		/* This allocation cannot fail */
-		region = alloc_bootmem_low(sizeof(struct nosave_region));
+		region = alloc_bootmem(sizeof(struct nosave_region));
 	region->start_pfn = start_pfn;
 	region->end_pfn = end_pfn;
 	list_add_tail(&region->list, &nosave_regions);




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

end of thread, other threads:[~2009-08-18 15:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-30 11:20 [PATCH] don't use alloc_bootmem_low() where not strictly needed Jan Beulich
2009-06-30 22:03 ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2009-08-18 15:54 Jan Beulich

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