Commit 8b3cd09e authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar

x86_64: make reserve_bootmem_generic() use new reserve_bootmem()

"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: default avatarYinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent a5645a61
...@@ -810,7 +810,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) ...@@ -810,7 +810,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
void __init reserve_bootmem_generic(unsigned long phys, unsigned len) void __init reserve_bootmem_generic(unsigned long phys, unsigned len)
{ {
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
int nid = phys_to_nid(phys); int nid, next_nid;
#endif #endif
unsigned long pfn = phys >> PAGE_SHIFT; unsigned long pfn = phys >> PAGE_SHIFT;
...@@ -829,10 +829,16 @@ void __init reserve_bootmem_generic(unsigned long phys, unsigned len) ...@@ -829,10 +829,16 @@ void __init reserve_bootmem_generic(unsigned long phys, unsigned len)
/* Should check here against the e820 map to avoid double free */ /* Should check here against the e820 map to avoid double free */
#ifdef CONFIG_NUMA #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 #else
reserve_bootmem(phys, len, BOOTMEM_DEFAULT); reserve_bootmem(phys, len, BOOTMEM_DEFAULT);
#endif #endif
if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) { if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) {
dma_reserve += len / PAGE_SIZE; dma_reserve += len / PAGE_SIZE;
set_dma_reserve(dma_reserve); set_dma_reserve(dma_reserve);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment