Re: [git pull] "big box" x86 changes, bootmem/sparsemem

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ingo Molnar
Date: Saturday, April 26, 2008 - 1:07 pm

* Linus Torvalds <torvalds@linux-foundation.org> wrote:


for now i cleaned it up the way below, but i also queued up a cleanup 
patch separately (second patch attached below) that removes the #ifdef. 
The current version is the tested one so i'll keep that in the tree and 
will treat the cleanup separately.

	Ingo

------------------------>
Subject: x86_64: make reserve_bootmem_generic() use new reserve_bootmem()
From: Yinghai Lu <yhlu.kernel@gmail.com>
Date: Tue, 18 Mar 2008 12:50:21 -0700

"mm: make reserve_bootmem can crossed the nodes" provides new
reserve_bootmem(), let reserve_bootmem_generic() use that.

reserve_bootmem_generic() is used to reserve initramdisk, so this way
we can make sure even when bootloader or kexec load ranges cross the
node memory boundaries, reserve_bootmem still works.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/mm/init_64.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Index: linux-x86.q/arch/x86/mm/init_64.c
===================================================================
--- linux-x86.q.orig/arch/x86/mm/init_64.c
+++ linux-x86.q/arch/x86/mm/init_64.c
@@ -810,7 +810,7 @@ void free_initrd_mem(unsigned long start
 void __init reserve_bootmem_generic(unsigned long phys, unsigned len)
 {
 #ifdef CONFIG_NUMA
-	int nid = phys_to_nid(phys);
+	int nid, next_nid;
 #endif
 	unsigned long pfn = phys >> PAGE_SHIFT;
 
@@ -829,10 +829,16 @@ void __init reserve_bootmem_generic(unsi
 
 	/* Should check here against the e820 map to avoid double free */
 #ifdef CONFIG_NUMA
-	reserve_bootmem_node(NODE_DATA(nid), phys, len, BOOTMEM_DEFAULT);
+	nid = phys_to_nid(phys);
+	next_nid = phys_to_nid(phys + len - 1);
+	if (nid == next_nid)
+		reserve_bootmem_node(NODE_DATA(nid), phys, len, BOOTMEM_DEFAULT);
+	else
+		reserve_bootmem(phys, len, BOOTMEM_DEFAULT);
 #else
 	reserve_bootmem(phys, len, BOOTMEM_DEFAULT);
 #endif
+
 	if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) {
 		dma_reserve += len / PAGE_SIZE;
 		set_dma_reserve(dma_reserve);

------------->
Subject: x86: reserve bootmem cleanup
From: Ingo Molnar <mingo@elte.hu>
Date: Sat Apr 26 21:50:20 CEST 2008

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/mm/init_64.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Index: linux-x86.q/arch/x86/mm/init_64.c
===================================================================
--- linux-x86.q.orig/arch/x86/mm/init_64.c
+++ linux-x86.q/arch/x86/mm/init_64.c
@@ -810,10 +810,8 @@ void free_initrd_mem(unsigned long start
 
 void __init reserve_bootmem_generic(unsigned long phys, unsigned len)
 {
-#ifdef CONFIG_NUMA
-	int nid, next_nid;
-#endif
 	unsigned long pfn = phys >> PAGE_SHIFT;
+	int nid, next_nid;
 
 	if (pfn >= end_pfn) {
 		/*
@@ -829,16 +827,12 @@ void __init reserve_bootmem_generic(unsi
 	}
 
 	/* Should check here against the e820 map to avoid double free */
-#ifdef CONFIG_NUMA
 	nid = phys_to_nid(phys);
 	next_nid = phys_to_nid(phys + len - 1);
 	if (nid == next_nid)
 		reserve_bootmem_node(NODE_DATA(nid), phys, len, BOOTMEM_DEFAULT);
 	else
 		reserve_bootmem(phys, len, BOOTMEM_DEFAULT);
-#else
-	reserve_bootmem(phys, len, BOOTMEM_DEFAULT);
-#endif
 
 	if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) {
 		dma_reserve += len / PAGE_SIZE;
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC git pull] &quot;big box&quot; x86 changes, Ingo Molnar, (Sat Apr 26, 11:55 am)
Re: [RFC git pull] &quot;big box&quot; x86 changes, Stefan Richter, (Sat Apr 26, 12:05 pm)
Re: [RFC git pull] &quot;big box&quot; x86 changes, Linus Torvalds, (Sat Apr 26, 12:12 pm)
Re: [RFC git pull] &quot;big box&quot; x86 changes, Ingo Molnar, (Sat Apr 26, 12:21 pm)
Re: [git pull] "big box" x86 changes, bootmem/sparsemem, Ingo Molnar, (Sat Apr 26, 1:07 pm)
[RFC git pull] &quot;big box&quot; x86 changes, GART, Ingo Molnar, (Sat Apr 26, 1:24 pm)
[git pull] &quot;big box&quot; x86 changes, PCI, Ingo Molnar, (Sat Apr 26, 2:55 pm)
Re: [RFC git pull] &quot;big box&quot; x86 changes, Andi Kleen, (Sat Apr 26, 3:17 pm)
Re: [git pull] &quot;big box&quot; x86 changes, boot protocol, Jeremy Fitzhardinge, (Sat Apr 26, 4:37 pm)
Re: [RFC git pull] &quot;big box&quot; x86 changes, Yinghai Lu, (Sat Apr 26, 8:14 pm)
Re: [RFC git pull] &quot;big box&quot; x86 changes, Andi Kleen, (Sun Apr 27, 1:30 am)
Re: [git pull] &quot;big box&quot; x86 changes, PCI, Jesse Barnes, (Sun Apr 27, 9:30 am)
[patch] mm: node-setup agnostic free_bootmem(), Ingo Molnar, (Sun Apr 27, 5:40 pm)
Re: [patch] mm: node-setup agnostic free_bootmem(), Yinghai Lu, (Sun Apr 27, 6:48 pm)
Re: [git pull] &quot;big box&quot; x86 changes, PCI, Ingo Molnar, (Mon Apr 28, 8:38 am)
Re: [patch] mm: node-setup agnostic free_bootmem(), Johannes Weiner, (Mon Apr 28, 9:49 am)
Re: [patch] mm: node-setup agnostic free_bootmem(), Johannes Weiner, (Mon Apr 28, 9:54 am)
Re: [patch] mm: node-setup agnostic free_bootmem(), Yinghai Lu, (Mon Apr 28, 12:11 pm)
Re: [patch] mm: node-setup agnostic free_bootmem(), Yinghai Lu, (Mon Apr 28, 12:55 pm)
Re: [git pull] &quot;big box&quot; x86 changes, PCI, Jesse Barnes, (Mon Apr 28, 1:34 pm)
Re: [git pull] &quot;big box&quot; x86 changes, PCI, Yinghai Lu, (Mon Apr 28, 3:53 pm)
Re: [patch] mm: node-setup agnostic free_bootmem(), Ingo Molnar, (Tue Apr 29, 7:25 am)
Re: [patch] mm: node-setup agnostic free_bootmem(), Johannes Weiner, (Wed Apr 30, 3:50 am)
Re: [patch] mm: node-setup agnostic free_bootmem(), Johannes Weiner, (Wed Apr 30, 3:52 am)
Re: [patch] mm: node-setup agnostic free_bootmem(), Yinghai Lu, (Wed Apr 30, 9:22 am)
Re: [patch] mm: node-setup agnostic free_bootmem(), Johannes Weiner, (Wed Apr 30, 10:52 am)
Re: [patch] mm: node-setup agnostic free_bootmem(), Yinghai Lu, (Wed Apr 30, 1:30 pm)