Commit 1db9716d authored by Rong Qianfeng's avatar Rong Qianfeng Committed by Will Deacon

arm64/mm: Delete __init region from memblock.reserved

If CONFIG_ARCH_KEEP_MEMBLOCK is enabled, the memory information in
memblock will be retained.  We release the __init memory here, and
we should also delete the corresponding region in memblock.reserved,
which allows debugfs/memblock/reserved to display correct memory
information.
Signed-off-by: default avatarRong Qianfeng <rongqianfeng@vivo.com>
Link: https://lore.kernel.org/r/20240902023940.43227-1-rongqianfeng@vivo.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
parent 7c626ce4
......@@ -414,6 +414,12 @@ void __init mem_init(void)
void free_initmem(void)
{
unsigned long aligned_begin = ALIGN_DOWN((u64)__init_begin, PAGE_SIZE);
unsigned long aligned_end = ALIGN((u64)__init_end, PAGE_SIZE);
/* Delete __init region from memblock.reserved. */
memblock_free((void *)aligned_begin, aligned_end - aligned_begin);
free_reserved_area(lm_alias(__init_begin),
lm_alias(__init_end),
POISON_FREE_INITMEM, "unused kernel");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment