powerpc/fadump: make use of memblock's bottom up allocation mode
Earlier, memblock_find_in_range() was not used to find the memory to
be reserved for FADump as bottom up allocation mode was not supported.
But since commit 79442ed189
("mm/memblock.c: introduce bottom-up
allocation mode") bottom up allocation mode is supported for memblock.
So, use it to find the memory to be reserved for FADump.
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/156821364211.5656.14336025460336135194.stgit@hbathini.in.ibm.com
This commit is contained in:
Родитель
fbcafdaea2
Коммит
579ca1a276
|
@ -342,7 +342,8 @@ static void __init fadump_reserve_crash_area(unsigned long base,
|
||||||
|
|
||||||
int __init fadump_reserve_mem(void)
|
int __init fadump_reserve_mem(void)
|
||||||
{
|
{
|
||||||
u64 base, size, mem_boundary;
|
bool is_memblock_bottom_up = memblock_bottom_up();
|
||||||
|
u64 base, size, mem_boundary, align = PAGE_SIZE;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
if (!fw_dump.fadump_enabled)
|
if (!fw_dump.fadump_enabled)
|
||||||
|
@ -362,10 +363,11 @@ int __init fadump_reserve_mem(void)
|
||||||
fw_dump.boot_memory_size =
|
fw_dump.boot_memory_size =
|
||||||
PAGE_ALIGN(fadump_calculate_reserve_size());
|
PAGE_ALIGN(fadump_calculate_reserve_size());
|
||||||
#ifdef CONFIG_CMA
|
#ifdef CONFIG_CMA
|
||||||
if (!fw_dump.nocma)
|
if (!fw_dump.nocma) {
|
||||||
|
align = FADUMP_CMA_ALIGNMENT;
|
||||||
fw_dump.boot_memory_size =
|
fw_dump.boot_memory_size =
|
||||||
ALIGN(fw_dump.boot_memory_size,
|
ALIGN(fw_dump.boot_memory_size, align);
|
||||||
FADUMP_CMA_ALIGNMENT);
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,19 +421,15 @@ int __init fadump_reserve_mem(void)
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Reserve memory at an offset closer to bottom of the RAM to
|
* Reserve memory at an offset closer to bottom of the RAM to
|
||||||
* minimize the impact of memory hot-remove operation. We can't
|
* minimize the impact of memory hot-remove operation.
|
||||||
* use memblock_find_in_range() here since it doesn't allocate
|
|
||||||
* from bottom to top.
|
|
||||||
*/
|
*/
|
||||||
while (base <= (mem_boundary - size)) {
|
memblock_set_bottom_up(true);
|
||||||
if (memblock_is_region_memory(base, size) &&
|
base = memblock_find_in_range(base, mem_boundary, size, align);
|
||||||
!memblock_is_region_reserved(base, size))
|
|
||||||
break;
|
|
||||||
|
|
||||||
base += size;
|
/* Restore the previous allocation mode */
|
||||||
}
|
memblock_set_bottom_up(is_memblock_bottom_up);
|
||||||
|
|
||||||
if (base > (mem_boundary - size)) {
|
if (!base) {
|
||||||
pr_err("Failed to find memory chunk for reservation!\n");
|
pr_err("Failed to find memory chunk for reservation!\n");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче