Skip to content

Commit

Permalink
mm/microblaze: use common help functions to free reserved pages
Browse files Browse the repository at this point in the history
Use common help functions to free reserved pages.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Michal Simek <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
jiangliu authored and torvalds committed Apr 29, 2013
1 parent 920f1ad commit 7beb598
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
1 change: 0 additions & 1 deletion arch/microblaze/include/asm/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ void machine_shutdown(void);
void machine_halt(void);
void machine_power_off(void);

void free_init_pages(char *what, unsigned long begin, unsigned long end);
extern void *alloc_maybe_bootmem(size_t size, gfp_t mask);
extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);

Expand Down
28 changes: 2 additions & 26 deletions arch/microblaze/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,40 +236,16 @@ void __init setup_memory(void)
paging_init();
}

void free_init_pages(char *what, unsigned long begin, unsigned long end)
{
unsigned long addr;

for (addr = begin; addr < end; addr += PAGE_SIZE) {
ClearPageReserved(virt_to_page(addr));
init_page_count(virt_to_page(addr));
free_page(addr);
totalram_pages++;
}
pr_info("Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
}

#ifdef CONFIG_BLK_DEV_INITRD
void free_initrd_mem(unsigned long start, unsigned long end)
{
int pages = 0;
for (; start < end; start += PAGE_SIZE) {
ClearPageReserved(virt_to_page(start));
init_page_count(virt_to_page(start));
free_page(start);
totalram_pages++;
pages++;
}
pr_notice("Freeing initrd memory: %dk freed\n",
(int)(pages * (PAGE_SIZE / 1024)));
free_reserved_area(start, end, 0, "initrd");
}
#endif

void free_initmem(void)
{
free_init_pages("unused kernel memory",
(unsigned long)(&__init_begin),
(unsigned long)(&__init_end));
free_initmem_default(0);
}

void __init mem_init(void)
Expand Down

0 comments on commit 7beb598

Please sign in to comment.