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

!1790 [sync] PR-1650: mm: disable kernelcore=mirror when no mirror memory

Merge Pull Request from: @openeuler-sync-bot 
 

Origin pull request: 
https://gitee.com/openeuler/kernel/pulls/1650 
 
PR sync from: Wupeng Ma <mawupeng1@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/Q626MLFO7JFVGNUVF6P3WFB2J7I2UMFY/ 
 
https://gitee.com/openeuler/kernel/issues/I7QV2C 
 
Link:https://gitee.com/openeuler/kernel/pulls/1790 

Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com> 
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
......@@ -2493,6 +2493,7 @@ extern void get_pfn_range_for_nid(unsigned int nid,
extern unsigned long find_min_pfn_with_active_regions(void);
extern bool mirrored_kernelcore;
extern bool memblock_has_mirror(void);
#ifndef CONFIG_NEED_MULTIPLE_NODES
static inline int early_pfn_to_nid(unsigned long pfn)
......
......@@ -161,6 +161,11 @@ static int memblock_can_resize __initdata_memblock;
static int memblock_memory_in_slab __initdata_memblock = 0;
static int memblock_reserved_in_slab __initdata_memblock = 0;
bool __init_memblock memblock_has_mirror(void)
{
return system_has_some_mirror;
}
static enum memblock_flags __init_memblock choose_memblock_flags(void)
{
return system_has_some_mirror ? MEMBLOCK_MIRROR : MEMBLOCK_NONE;
......
......@@ -7741,6 +7741,11 @@ static void __init find_zone_movable_pfns_for_nodes(void)
bool has_unmirrored_mem = false;
unsigned long mirrored_sz = 0;
if (!memblock_has_mirror()) {
pr_warn("The system has no mirror memory, ignore kernelcore=mirror.\n");
goto out;
}
for_each_mem_region(r) {
if (memblock_is_mirror(r)) {
mirrored_sz += r->size;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册