summary refs log tree commit diff
path: root/arch/csky
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2021-01-26 19:14:20 +0100
committerGuo Ren <guoren@linux.alibaba.com>2021-02-27 16:35:09 +0800
commit5d3f410fa9f35bd6378109a08b143d1d91ace588 (patch)
treeece11bfce342787f46ac2aa79f70f61dccf2953e /arch/csky
parentc47e1a1cb6d473172d4d9c24056960bd542dc56c (diff)
downloadlinux-5d3f410fa9f35bd6378109a08b143d1d91ace588.tar.gz
csky: use free_initmem_default() in free_initmem()
The existing code is essentially
free_initmem_default()->free_reserved_area() without poisoning.

Note that existing code missed to update the managed page count of the
zone.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Wei Yang <richard.weiyang@linux.alibaba.com>
Tested-by: Guo Ren <guoren@kernel.org>
Signed-off-by: Guo Ren <guoren@kernel.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Diffstat (limited to 'arch/csky')
-rw-r--r--arch/csky/mm/init.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/arch/csky/mm/init.c b/arch/csky/mm/init.c
index 81e4e5e78f38..894050a8ce09 100644
--- a/arch/csky/mm/init.c
+++ b/arch/csky/mm/init.c
@@ -110,24 +110,9 @@ void __init mem_init(void)
 	mem_init_print_info(NULL);
 }
 
-extern char __init_begin[], __init_end[];
-
 void free_initmem(void)
 {
-	unsigned long addr;
-
-	addr = (unsigned long) &__init_begin;
-
-	while (addr < (unsigned long) &__init_end) {
-		ClearPageReserved(virt_to_page(addr));
-		init_page_count(virt_to_page(addr));
-		free_page(addr);
-		totalram_pages_inc();
-		addr += PAGE_SIZE;
-	}
-
-	pr_info("Freeing unused kernel memory: %dk freed\n",
-	((unsigned int)&__init_end - (unsigned int)&__init_begin) >> 10);
+	free_initmem_default(-1);
 }
 
 void pgd_init(unsigned long *p)