[RESEND][PATCH] ARM: mm: Free memblock from free_initrd_mem()

Seung-Woo Kim sw0312.kim at samsung.com
Tue Jan 26 23:17:26 EST 2021


Even after free_initrd_mem(), memblock for initrd remains. Free
memblock for initrd from free_initrd_mem() line generic function.

Reported-by: Jaehoon Chung <jh80.chung at samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim at samsung.com>
---
 arch/arm/mm/init.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 828a256..f7db023 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -530,6 +530,13 @@ void free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
+#ifdef CONFIG_ARCH_KEEP_MEMBLOCK
+	unsigned long aligned_start = ALIGN_DOWN(start, PAGE_SIZE);
+	unsigned long aligned_end = ALIGN(end, PAGE_SIZE);
+
+	memblock_free(__pa(aligned_start), aligned_end - aligned_start);
+#endif
+
 	if (start == initrd_start)
 		start = round_down(start, PAGE_SIZE);
 	if (end == initrd_end)
-- 
1.7.4.1




More information about the linux-arm-kernel mailing list