未验证 提交 10c2d19f 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!866 arm64: kdump: Avoid reserving low memory repeatedly

Merge Pull Request from: @ci-robot 
 
PR sync from:  Li Huafei <lihuafei1@huawei.com>
 https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/thread/QXUYQDQ4DEHNVIFCOSKUQF5GRGQKLRPI/ 
 
 
Link:https://gitee.com/openeuler/kernel/pulls/866 

Reviewed-by: Jialin Zhang <zhangjialin11@huawei.com> 
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
...@@ -440,6 +440,13 @@ static void __init free_reserved_high_mem(void) ...@@ -440,6 +440,13 @@ static void __init free_reserved_high_mem(void)
memblock_free(crashk_res_high.start, resource_size(&crashk_res_high)); memblock_free(crashk_res_high.start, resource_size(&crashk_res_high));
} }
static bool __init within_low_mem(unsigned long long crash_base,
unsigned long long crash_size)
{
return crash_base < CRASH_ADDR_LOW_MAX &&
CRASH_ADDR_LOW_MAX - crash_base >= crash_size;
}
/* /*
* reserve_crashkernel() - reserves memory for crash kernel * reserve_crashkernel() - reserves memory for crash kernel
* *
...@@ -469,6 +476,8 @@ void __init reserve_crashkernel(void) ...@@ -469,6 +476,8 @@ void __init reserve_crashkernel(void)
if (crash_high_mem_reserved) { if (crash_high_mem_reserved) {
take_reserved_high_mem(&crash_base, &crash_size); take_reserved_high_mem(&crash_base, &crash_size);
if (within_low_mem(crash_base, crash_size))
goto reserve_ok;
goto reserve_low; goto reserve_low;
} }
} }
...@@ -490,6 +499,8 @@ void __init reserve_crashkernel(void) ...@@ -490,6 +499,8 @@ void __init reserve_crashkernel(void)
CRASH_ALIGN); CRASH_ALIGN);
if (!crash_base && crash_high_mem_reserved) { if (!crash_base && crash_high_mem_reserved) {
take_reserved_high_mem(&crash_base, &crash_size); take_reserved_high_mem(&crash_base, &crash_size);
if (within_low_mem(crash_base, crash_size))
goto reserve_ok;
goto reserve_low; goto reserve_low;
} }
} }
...@@ -539,6 +550,7 @@ void __init reserve_crashkernel(void) ...@@ -539,6 +550,7 @@ void __init reserve_crashkernel(void)
free_reserved_high_mem(); free_reserved_high_mem();
} }
reserve_ok:
pr_info("Reserving %ldMB of memory at %ldMB for crashkernel (System RAM: %ldMB)\n", pr_info("Reserving %ldMB of memory at %ldMB for crashkernel (System RAM: %ldMB)\n",
(unsigned long)(crash_size >> 20), (unsigned long)(crash_size >> 20),
(unsigned long)(crash_base >> 20), (unsigned long)(crash_base >> 20),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册