Skip to content

Commit

Permalink
csky: use free_initmem_default() in free_initmem()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
davidhildenbrand authored and guoren83 committed Jan 27, 2021
1 parent 717f1b1 commit 9d986b0
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions arch/csky/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9d986b0

Please sign in to comment.