mm/mm_init: Ignore kernelcore=mirror boot option when no mirror memory presents.
Commit Message
In the machine where no mirror memory is set,
All memory region in ZONE_NORMAL is used as ZONE_MOVABLE
when kernelcore=mirror boot option is used.
So, ZONE_NORMAL couldn't be populated properly
because all of ZONE_NORMAL pages is absent.
To avoid this abnormal situation,
ignore disable kernelcore=mirror option when no mirror memory is found.
Signed-off-by: Levi Yun <ppbuk5246@gmail.com>
---
mm/mm_init.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
@@ -376,10 +376,13 @@ static void __init find_zone_movable_pfns_for_nodes(void)
*/
if (mirrored_kernelcore) {
bool mem_below_4gb_not_mirrored = false;
+ bool no_mirror_mem = true;
for_each_mem_region(r) {
- if (memblock_is_mirror(r))
+ if (memblock_is_mirror(r)) {
+ no_mirror_mem = false;
continue;
+ }
nid = memblock_get_region_node(r);
@@ -398,6 +401,12 @@ static void __init find_zone_movable_pfns_for_nodes(void)
if (mem_below_4gb_not_mirrored)
pr_warn("This configuration results in unmirrored kernel memory.\n");
+ if (no_mirror_mem) {
+ pr_warn("There is no mirrored memory. Ignore kernelcore=mirror.\n");
+ mirrored_kernelcore = false;
+ memset(zone_movable_pfn, 0x00, sizeof(zone_movable_pfn));
+ }
+
goto out2;
}