aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/mm
diff options
context:
space:
mode:
authorJiang Liu <liuj97@gmail.com>2013-04-29 18:06:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 18:54:31 -0400
commit88448b65a878525f63f9c0e4bdbf4e74d1960ad2 (patch)
tree053596fddffae77b023b952eb190cb960494234f /arch/sh/mm
parent7265d80f06f9d265a329a24df3b65c5b8d3612ce (diff)
mm/SH: use common help functions to free reserved pages
Use common help functions to free reserved pages. Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Acked-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/sh/mm')
-rw-r--r--arch/sh/mm/init.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 105794037143..20f9ead650d3 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -417,15 +417,13 @@ void __init mem_init(void)
417 417
418 for_each_online_node(nid) { 418 for_each_online_node(nid) {
419 pg_data_t *pgdat = NODE_DATA(nid); 419 pg_data_t *pgdat = NODE_DATA(nid);
420 unsigned long node_pages = 0;
421 void *node_high_memory; 420 void *node_high_memory;
422 421
423 num_physpages += pgdat->node_present_pages; 422 num_physpages += pgdat->node_present_pages;
424 423
425 if (pgdat->node_spanned_pages) 424 if (pgdat->node_spanned_pages)
426 node_pages = free_all_bootmem_node(pgdat); 425 totalram_pages += free_all_bootmem_node(pgdat);
427 426
428 totalram_pages += node_pages;
429 427
430 node_high_memory = (void *)__va((pgdat->node_start_pfn + 428 node_high_memory = (void *)__va((pgdat->node_start_pfn +
431 pgdat->node_spanned_pages) << 429 pgdat->node_spanned_pages) <<
@@ -501,31 +499,13 @@ void __init mem_init(void)
501 499
502void free_initmem(void) 500void free_initmem(void)
503{ 501{
504 unsigned long addr; 502 free_initmem_default(0);
505
506 addr = (unsigned long)(&__init_begin);
507 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
508 ClearPageReserved(virt_to_page(addr));
509 init_page_count(virt_to_page(addr));
510 free_page(addr);
511 totalram_pages++;
512 }
513 printk("Freeing unused kernel memory: %ldk freed\n",
514 ((unsigned long)&__init_end -
515 (unsigned long)&__init_begin) >> 10);
516} 503}
517 504
518#ifdef CONFIG_BLK_DEV_INITRD 505#ifdef CONFIG_BLK_DEV_INITRD
519void free_initrd_mem(unsigned long start, unsigned long end) 506void free_initrd_mem(unsigned long start, unsigned long end)
520{ 507{
521 unsigned long p; 508 free_reserved_area(start, end, 0, "initrd");
522 for (p = start; p < end; p += PAGE_SIZE) {
523 ClearPageReserved(virt_to_page(p));
524 init_page_count(virt_to_page(p));
525 free_page(p);
526 totalram_pages++;
527 }
528 printk("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
529} 509}
530#endif 510#endif
531 511