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>
This commit is contained in:
parent
c47e1a1cb6
commit
5d3f410fa9
@ -110,24 +110,9 @@ void __init mem_init(void)
|
|||||||
mem_init_print_info(NULL);
|
mem_init_print_info(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern char __init_begin[], __init_end[];
|
|
||||||
|
|
||||||
void free_initmem(void)
|
void free_initmem(void)
|
||||||
{
|
{
|
||||||
unsigned long addr;
|
free_initmem_default(-1);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pgd_init(unsigned long *p)
|
void pgd_init(unsigned long *p)
|
||||||
|
Loading…
Reference in New Issue
Block a user