* [PATCH v2 1/3] mm: use memblock_alloc_range_nid() and memblock_alloc_range()
@ 2014-09-08 23:38 ` Akinobu Mita
0 siblings, 0 replies; 6+ messages in thread
From: Akinobu Mita @ 2014-09-08 23:38 UTC (permalink / raw)
To: linux-kernel; +Cc: Akinobu Mita, Sabrina Dubroca, linux-mm
memblock_alloc_range_nid() is equivalent to memblock_find_in_range_node()
followed by memblock_reserve(). memblock_alloc_range() is equivalent to
memblock_alloc_range_nid() with NUMA_NO_NODE for any node.
Convert to use these functions and remove subsequent kmemleak_alloc()
call as it is already called in memblock_alloc() and its variants.
This is just a cleanup.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Sabrina Dubroca <sd@queasysnail.net>
Cc: linux-mm@kvack.org
---
* v2: fix overlapping kmemleak_alloc() calls, reported by Sabrina Dubroca.
mm/memblock.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index 70fad0c..a942f6e 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1150,21 +1150,16 @@ static void * __init memblock_virt_alloc_internal(
if (WARN_ON_ONCE(slab_is_available()))
return kzalloc_node(size, GFP_NOWAIT, nid);
- if (!align)
- align = SMP_CACHE_BYTES;
-
if (max_addr > memblock.current_limit)
max_addr = memblock.current_limit;
again:
- alloc = memblock_find_in_range_node(size, align, min_addr, max_addr,
- nid);
+ alloc = memblock_alloc_range_nid(size, align, min_addr, max_addr, nid);
if (alloc)
goto done;
if (nid != NUMA_NO_NODE) {
- alloc = memblock_find_in_range_node(size, align, min_addr,
- max_addr, NUMA_NO_NODE);
+ alloc = memblock_alloc_range(size, align, min_addr, max_addr);
if (alloc)
goto done;
}
@@ -1177,18 +1172,9 @@ again:
}
done:
- memblock_reserve(alloc, size);
ptr = phys_to_virt(alloc);
memset(ptr, 0, size);
- /*
- * The min_count is set to 0 so that bootmem allocated blocks
- * are never reported as leaks. This is because many of these blocks
- * are only referred via the physical address which is not
- * looked up by kmemleak.
- */
- kmemleak_alloc(ptr, size, 0, 0);
-
return ptr;
error:
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 1/3] mm: use memblock_alloc_range_nid() and memblock_alloc_range()
@ 2014-09-08 23:38 ` Akinobu Mita
0 siblings, 0 replies; 6+ messages in thread
From: Akinobu Mita @ 2014-09-08 23:38 UTC (permalink / raw)
To: linux-kernel; +Cc: Akinobu Mita, Sabrina Dubroca, linux-mm
memblock_alloc_range_nid() is equivalent to memblock_find_in_range_node()
followed by memblock_reserve(). memblock_alloc_range() is equivalent to
memblock_alloc_range_nid() with NUMA_NO_NODE for any node.
Convert to use these functions and remove subsequent kmemleak_alloc()
call as it is already called in memblock_alloc() and its variants.
This is just a cleanup.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Sabrina Dubroca <sd@queasysnail.net>
Cc: linux-mm@kvack.org
---
* v2: fix overlapping kmemleak_alloc() calls, reported by Sabrina Dubroca.
mm/memblock.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index 70fad0c..a942f6e 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1150,21 +1150,16 @@ static void * __init memblock_virt_alloc_internal(
if (WARN_ON_ONCE(slab_is_available()))
return kzalloc_node(size, GFP_NOWAIT, nid);
- if (!align)
- align = SMP_CACHE_BYTES;
-
if (max_addr > memblock.current_limit)
max_addr = memblock.current_limit;
again:
- alloc = memblock_find_in_range_node(size, align, min_addr, max_addr,
- nid);
+ alloc = memblock_alloc_range_nid(size, align, min_addr, max_addr, nid);
if (alloc)
goto done;
if (nid != NUMA_NO_NODE) {
- alloc = memblock_find_in_range_node(size, align, min_addr,
- max_addr, NUMA_NO_NODE);
+ alloc = memblock_alloc_range(size, align, min_addr, max_addr);
if (alloc)
goto done;
}
@@ -1177,18 +1172,9 @@ again:
}
done:
- memblock_reserve(alloc, size);
ptr = phys_to_virt(alloc);
memset(ptr, 0, size);
- /*
- * The min_count is set to 0 so that bootmem allocated blocks
- * are never reported as leaks. This is because many of these blocks
- * are only referred via the physical address which is not
- * looked up by kmemleak.
- */
- kmemleak_alloc(ptr, size, 0, 0);
-
return ptr;
error:
--
1.9.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] x86: use memblock_alloc_range()
2014-09-08 23:38 ` Akinobu Mita
@ 2014-09-08 23:38 ` Akinobu Mita
-1 siblings, 0 replies; 6+ messages in thread
From: Akinobu Mita @ 2014-09-08 23:38 UTC (permalink / raw)
To: linux-kernel
Cc: Akinobu Mita, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
linux-mm
memblock_alloc_range() is equivalent to memblock_find_in_range()
followed by memblock_reserve(). Convert to use it where possible.
This is mainly a cleanup. Also, memblock_alloc_range() calls
kmemleak_alloc() for allocated memory block with min_count of 0, so that
it is never reported as leaks.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: linux-mm@kvack.org
---
* v2: split from membloc_alloc_base() conversions.
arch/x86/kernel/aperture_64.c | 6 +++---
arch/x86/kernel/setup.c | 17 ++++++++---------
arch/x86/mm/init.c | 7 +++----
3 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 76164e1..baaa7c9 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -74,14 +74,14 @@ static u32 __init allocate_aperture(void)
* memory. Unfortunately we cannot move it up because that would
* make the IOMMU useless.
*/
- addr = memblock_find_in_range(GART_MIN_ADDR, GART_MAX_ADDR,
- aper_size, aper_size);
+ addr = memblock_alloc_range(aper_size, aper_size,
+ GART_MIN_ADDR, GART_MAX_ADDR);
+
if (!addr) {
pr_err("Cannot allocate aperture memory hole [mem %#010lx-%#010lx] (%uKB)\n",
addr, addr + aper_size - 1, aper_size >> 10);
return 0;
}
- memblock_reserve(addr, aper_size);
pr_info("Mapping aperture over RAM [mem %#010lx-%#010lx] (%uKB)\n",
addr, addr + aper_size - 1, aper_size >> 10);
register_nosave_region(addr >> PAGE_SHIFT,
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 41ead8d..7d32406 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -545,8 +545,8 @@ static void __init reserve_crashkernel_low(void)
return;
}
- low_base = memblock_find_in_range(low_size, (1ULL<<32),
- low_size, alignment);
+ low_base = memblock_alloc_range(low_size, alignment,
+ low_size, 1ULL << 32);
if (!low_base) {
if (!auto_set)
@@ -555,7 +555,6 @@ static void __init reserve_crashkernel_low(void)
return;
}
- memblock_reserve(low_base, low_size);
pr_info("Reserving %ldMB of low memory at %ldMB for crashkernel (System low RAM: %ldMB)\n",
(unsigned long)(low_size >> 20),
(unsigned long)(low_base >> 20),
@@ -593,10 +592,10 @@ static void __init reserve_crashkernel(void)
/*
* kexec want bzImage is below CRASH_KERNEL_ADDR_MAX
*/
- crash_base = memblock_find_in_range(alignment,
+ crash_base = memblock_alloc_range(crash_size, alignment,
+ alignment,
high ? CRASH_KERNEL_ADDR_HIGH_MAX :
- CRASH_KERNEL_ADDR_LOW_MAX,
- crash_size, alignment);
+ CRASH_KERNEL_ADDR_LOW_MAX);
if (!crash_base) {
pr_info("crashkernel reservation failed - No suitable area found.\n");
@@ -606,14 +605,14 @@ static void __init reserve_crashkernel(void)
} else {
unsigned long long start;
- start = memblock_find_in_range(crash_base,
- crash_base + crash_size, crash_size, 1<<20);
+ start = memblock_alloc_range(crash_size, 1 << 20,
+ crash_base,
+ crash_base + crash_size);
if (start != crash_base) {
pr_info("crashkernel reservation failed - memory is in use.\n");
return;
}
}
- memblock_reserve(crash_base, crash_size);
printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
"for crashkernel (System RAM: %ldMB)\n",
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 66dba36..76f67be 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -61,12 +61,11 @@ __ref void *alloc_low_pages(unsigned int num)
unsigned long ret;
if (min_pfn_mapped >= max_pfn_mapped)
panic("alloc_low_pages: ran out of memory");
- ret = memblock_find_in_range(min_pfn_mapped << PAGE_SHIFT,
- max_pfn_mapped << PAGE_SHIFT,
- PAGE_SIZE * num , PAGE_SIZE);
+ ret = memblock_alloc_range(PAGE_SIZE * num, PAGE_SIZE,
+ min_pfn_mapped << PAGE_SHIFT,
+ max_pfn_mapped << PAGE_SHIFT);
if (!ret)
panic("alloc_low_pages: can not alloc memory");
- memblock_reserve(ret, PAGE_SIZE * num);
pfn = ret >> PAGE_SHIFT;
} else {
pfn = pgt_buf_end;
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] x86: use memblock_alloc_range()
@ 2014-09-08 23:38 ` Akinobu Mita
0 siblings, 0 replies; 6+ messages in thread
From: Akinobu Mita @ 2014-09-08 23:38 UTC (permalink / raw)
To: linux-kernel
Cc: Akinobu Mita, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
linux-mm
memblock_alloc_range() is equivalent to memblock_find_in_range()
followed by memblock_reserve(). Convert to use it where possible.
This is mainly a cleanup. Also, memblock_alloc_range() calls
kmemleak_alloc() for allocated memory block with min_count of 0, so that
it is never reported as leaks.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: linux-mm@kvack.org
---
* v2: split from membloc_alloc_base() conversions.
arch/x86/kernel/aperture_64.c | 6 +++---
arch/x86/kernel/setup.c | 17 ++++++++---------
arch/x86/mm/init.c | 7 +++----
3 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 76164e1..baaa7c9 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -74,14 +74,14 @@ static u32 __init allocate_aperture(void)
* memory. Unfortunately we cannot move it up because that would
* make the IOMMU useless.
*/
- addr = memblock_find_in_range(GART_MIN_ADDR, GART_MAX_ADDR,
- aper_size, aper_size);
+ addr = memblock_alloc_range(aper_size, aper_size,
+ GART_MIN_ADDR, GART_MAX_ADDR);
+
if (!addr) {
pr_err("Cannot allocate aperture memory hole [mem %#010lx-%#010lx] (%uKB)\n",
addr, addr + aper_size - 1, aper_size >> 10);
return 0;
}
- memblock_reserve(addr, aper_size);
pr_info("Mapping aperture over RAM [mem %#010lx-%#010lx] (%uKB)\n",
addr, addr + aper_size - 1, aper_size >> 10);
register_nosave_region(addr >> PAGE_SHIFT,
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 41ead8d..7d32406 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -545,8 +545,8 @@ static void __init reserve_crashkernel_low(void)
return;
}
- low_base = memblock_find_in_range(low_size, (1ULL<<32),
- low_size, alignment);
+ low_base = memblock_alloc_range(low_size, alignment,
+ low_size, 1ULL << 32);
if (!low_base) {
if (!auto_set)
@@ -555,7 +555,6 @@ static void __init reserve_crashkernel_low(void)
return;
}
- memblock_reserve(low_base, low_size);
pr_info("Reserving %ldMB of low memory at %ldMB for crashkernel (System low RAM: %ldMB)\n",
(unsigned long)(low_size >> 20),
(unsigned long)(low_base >> 20),
@@ -593,10 +592,10 @@ static void __init reserve_crashkernel(void)
/*
* kexec want bzImage is below CRASH_KERNEL_ADDR_MAX
*/
- crash_base = memblock_find_in_range(alignment,
+ crash_base = memblock_alloc_range(crash_size, alignment,
+ alignment,
high ? CRASH_KERNEL_ADDR_HIGH_MAX :
- CRASH_KERNEL_ADDR_LOW_MAX,
- crash_size, alignment);
+ CRASH_KERNEL_ADDR_LOW_MAX);
if (!crash_base) {
pr_info("crashkernel reservation failed - No suitable area found.\n");
@@ -606,14 +605,14 @@ static void __init reserve_crashkernel(void)
} else {
unsigned long long start;
- start = memblock_find_in_range(crash_base,
- crash_base + crash_size, crash_size, 1<<20);
+ start = memblock_alloc_range(crash_size, 1 << 20,
+ crash_base,
+ crash_base + crash_size);
if (start != crash_base) {
pr_info("crashkernel reservation failed - memory is in use.\n");
return;
}
}
- memblock_reserve(crash_base, crash_size);
printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
"for crashkernel (System RAM: %ldMB)\n",
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 66dba36..76f67be 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -61,12 +61,11 @@ __ref void *alloc_low_pages(unsigned int num)
unsigned long ret;
if (min_pfn_mapped >= max_pfn_mapped)
panic("alloc_low_pages: ran out of memory");
- ret = memblock_find_in_range(min_pfn_mapped << PAGE_SHIFT,
- max_pfn_mapped << PAGE_SHIFT,
- PAGE_SIZE * num , PAGE_SIZE);
+ ret = memblock_alloc_range(PAGE_SIZE * num, PAGE_SIZE,
+ min_pfn_mapped << PAGE_SHIFT,
+ max_pfn_mapped << PAGE_SHIFT);
if (!ret)
panic("alloc_low_pages: can not alloc memory");
- memblock_reserve(ret, PAGE_SIZE * num);
pfn = ret >> PAGE_SHIFT;
} else {
pfn = pgt_buf_end;
--
1.9.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] x86: use __memblock_alloc_base() and memblock_alloc_base()
2014-09-08 23:38 ` Akinobu Mita
@ 2014-09-08 23:38 ` Akinobu Mita
-1 siblings, 0 replies; 6+ messages in thread
From: Akinobu Mita @ 2014-09-08 23:38 UTC (permalink / raw)
To: linux-kernel
Cc: Akinobu Mita, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
linux-mm
__memblock_alloc_base() is equivalent to memblock_find_in_range() with
the range starting from 0 and subsequent memblock_reserve() call.
memblock_alloc_base() is similar to __memblock_alloc_base(), but it
calls panic if the allocation fails. Convert to use these functions
where possible.
This is mainly a cleanup. Also, memblock_alloc_base() and its variants
call kmemleak_alloc() for allocated memory block with min_count of 0, so
that it is never reported as leaks.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: linux-mm@kvack.org
---
* v2: split from membloc_alloc_range() conversions, and avoid unexpected
panic on allocation failure.
arch/x86/kernel/setup.c | 9 ++-------
arch/x86/mm/numa.c | 4 +---
arch/x86/mm/numa_emulation.c | 5 ++---
arch/x86/realmode/init.c | 5 +----
4 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 7d32406..d3b1da5 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -327,16 +327,11 @@ static void __init relocate_initrd(void)
char *p, *q;
/* We need to move the initrd down into directly mapped mem */
- relocated_ramdisk = memblock_find_in_range(0, PFN_PHYS(max_pfn_mapped),
- area_size, PAGE_SIZE);
-
- if (!relocated_ramdisk)
- panic("Cannot find place for new RAMDISK of size %lld\n",
- ramdisk_size);
+ relocated_ramdisk = memblock_alloc_base(area_size, PAGE_SIZE,
+ PFN_PHYS(max_pfn_mapped));
/* Note: this includes all the mem currently occupied by
the initrd, we rely on that fact to keep the data intact. */
- memblock_reserve(relocated_ramdisk, area_size);
initrd_start = relocated_ramdisk + PAGE_OFFSET;
initrd_end = initrd_start + ramdisk_size;
printk(KERN_INFO "Allocated new RAMDISK: [mem %#010llx-%#010llx]\n",
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index a32b706..5deaa9b 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -375,15 +375,13 @@ static int __init numa_alloc_distance(void)
cnt++;
size = cnt * cnt * sizeof(numa_distance[0]);
- phys = memblock_find_in_range(0, PFN_PHYS(max_pfn_mapped),
- size, PAGE_SIZE);
+ phys = __memblock_alloc_base(size, PAGE_SIZE, PFN_PHYS(max_pfn_mapped));
if (!phys) {
pr_warning("NUMA: Warning: can't allocate distance table!\n");
/* don't retry until explicitly reset */
numa_distance = (void *)1LU;
return -ENOMEM;
}
- memblock_reserve(phys, size);
numa_distance = __va(phys);
numa_distance_cnt = cnt;
diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c
index a8f90ce..4dc3405 100644
--- a/arch/x86/mm/numa_emulation.c
+++ b/arch/x86/mm/numa_emulation.c
@@ -357,13 +357,12 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
if (numa_dist_cnt) {
u64 phys;
- phys = memblock_find_in_range(0, PFN_PHYS(max_pfn_mapped),
- phys_size, PAGE_SIZE);
+ phys = __memblock_alloc_base(phys_size, PAGE_SIZE,
+ PFN_PHYS(max_pfn_mapped));
if (!phys) {
pr_warning("NUMA: Warning: can't allocate copy of distance table, disabling emulation\n");
goto no_emu;
}
- memblock_reserve(phys, phys_size);
phys_dist = __va(phys);
for (i = 0; i < numa_dist_cnt; i++)
diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c
index bad628a..c6c212a 100644
--- a/arch/x86/realmode/init.c
+++ b/arch/x86/realmode/init.c
@@ -15,12 +15,9 @@ void __init reserve_real_mode(void)
size_t size = PAGE_ALIGN(real_mode_blob_end - real_mode_blob);
/* Has to be under 1M so we can execute real-mode AP code. */
- mem = memblock_find_in_range(0, 1<<20, size, PAGE_SIZE);
- if (!mem)
- panic("Cannot allocate trampoline\n");
+ mem = memblock_alloc_base(size, PAGE_SIZE, 1 << 20);
base = __va(mem);
- memblock_reserve(mem, size);
real_mode_header = (struct real_mode_header *) base;
printk(KERN_DEBUG "Base memory trampoline at [%p] %llx size %zu\n",
base, (unsigned long long)mem, size);
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] x86: use __memblock_alloc_base() and memblock_alloc_base()
@ 2014-09-08 23:38 ` Akinobu Mita
0 siblings, 0 replies; 6+ messages in thread
From: Akinobu Mita @ 2014-09-08 23:38 UTC (permalink / raw)
To: linux-kernel
Cc: Akinobu Mita, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
linux-mm
__memblock_alloc_base() is equivalent to memblock_find_in_range() with
the range starting from 0 and subsequent memblock_reserve() call.
memblock_alloc_base() is similar to __memblock_alloc_base(), but it
calls panic if the allocation fails. Convert to use these functions
where possible.
This is mainly a cleanup. Also, memblock_alloc_base() and its variants
call kmemleak_alloc() for allocated memory block with min_count of 0, so
that it is never reported as leaks.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: linux-mm@kvack.org
---
* v2: split from membloc_alloc_range() conversions, and avoid unexpected
panic on allocation failure.
arch/x86/kernel/setup.c | 9 ++-------
arch/x86/mm/numa.c | 4 +---
arch/x86/mm/numa_emulation.c | 5 ++---
arch/x86/realmode/init.c | 5 +----
4 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 7d32406..d3b1da5 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -327,16 +327,11 @@ static void __init relocate_initrd(void)
char *p, *q;
/* We need to move the initrd down into directly mapped mem */
- relocated_ramdisk = memblock_find_in_range(0, PFN_PHYS(max_pfn_mapped),
- area_size, PAGE_SIZE);
-
- if (!relocated_ramdisk)
- panic("Cannot find place for new RAMDISK of size %lld\n",
- ramdisk_size);
+ relocated_ramdisk = memblock_alloc_base(area_size, PAGE_SIZE,
+ PFN_PHYS(max_pfn_mapped));
/* Note: this includes all the mem currently occupied by
the initrd, we rely on that fact to keep the data intact. */
- memblock_reserve(relocated_ramdisk, area_size);
initrd_start = relocated_ramdisk + PAGE_OFFSET;
initrd_end = initrd_start + ramdisk_size;
printk(KERN_INFO "Allocated new RAMDISK: [mem %#010llx-%#010llx]\n",
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index a32b706..5deaa9b 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -375,15 +375,13 @@ static int __init numa_alloc_distance(void)
cnt++;
size = cnt * cnt * sizeof(numa_distance[0]);
- phys = memblock_find_in_range(0, PFN_PHYS(max_pfn_mapped),
- size, PAGE_SIZE);
+ phys = __memblock_alloc_base(size, PAGE_SIZE, PFN_PHYS(max_pfn_mapped));
if (!phys) {
pr_warning("NUMA: Warning: can't allocate distance table!\n");
/* don't retry until explicitly reset */
numa_distance = (void *)1LU;
return -ENOMEM;
}
- memblock_reserve(phys, size);
numa_distance = __va(phys);
numa_distance_cnt = cnt;
diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c
index a8f90ce..4dc3405 100644
--- a/arch/x86/mm/numa_emulation.c
+++ b/arch/x86/mm/numa_emulation.c
@@ -357,13 +357,12 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
if (numa_dist_cnt) {
u64 phys;
- phys = memblock_find_in_range(0, PFN_PHYS(max_pfn_mapped),
- phys_size, PAGE_SIZE);
+ phys = __memblock_alloc_base(phys_size, PAGE_SIZE,
+ PFN_PHYS(max_pfn_mapped));
if (!phys) {
pr_warning("NUMA: Warning: can't allocate copy of distance table, disabling emulation\n");
goto no_emu;
}
- memblock_reserve(phys, phys_size);
phys_dist = __va(phys);
for (i = 0; i < numa_dist_cnt; i++)
diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c
index bad628a..c6c212a 100644
--- a/arch/x86/realmode/init.c
+++ b/arch/x86/realmode/init.c
@@ -15,12 +15,9 @@ void __init reserve_real_mode(void)
size_t size = PAGE_ALIGN(real_mode_blob_end - real_mode_blob);
/* Has to be under 1M so we can execute real-mode AP code. */
- mem = memblock_find_in_range(0, 1<<20, size, PAGE_SIZE);
- if (!mem)
- panic("Cannot allocate trampoline\n");
+ mem = memblock_alloc_base(size, PAGE_SIZE, 1 << 20);
base = __va(mem);
- memblock_reserve(mem, size);
real_mode_header = (struct real_mode_header *) base;
printk(KERN_DEBUG "Base memory trampoline at [%p] %llx size %zu\n",
base, (unsigned long long)mem, size);
--
1.9.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-09-08 23:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-08 23:38 [PATCH v2 1/3] mm: use memblock_alloc_range_nid() and memblock_alloc_range() Akinobu Mita
2014-09-08 23:38 ` Akinobu Mita
2014-09-08 23:38 ` [PATCH v2 2/3] x86: use memblock_alloc_range() Akinobu Mita
2014-09-08 23:38 ` Akinobu Mita
2014-09-08 23:38 ` [PATCH v2 3/3] x86: use __memblock_alloc_base() and memblock_alloc_base() Akinobu Mita
2014-09-08 23:38 ` Akinobu Mita
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.