diff options
author | Jiang Liu <liuj97@gmail.com> | 2013-05-07 19:18:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-07 21:38:26 -0400 |
commit | 70affe4520c6f22f5b22b58b589c6ebbe3f8cbc9 (patch) | |
tree | a5d791be3fa2b58e9c527c9a1e0e0cfa2a94663f /arch/sparc/mm/init_32.c | |
parent | 0f47c9423c0fe468d0b5b153f9b9d6e8e20707eb (diff) |
mm/SPARC: 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: David S. Miller <davem@davemloft.net>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/sparc/mm/init_32.c')
-rw-r--r-- | arch/sparc/mm/init_32.c | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c index 4490c397bb5b..af472cf7c69a 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c | |||
@@ -366,45 +366,14 @@ void __init mem_init(void) | |||
366 | 366 | ||
367 | void free_initmem (void) | 367 | void free_initmem (void) |
368 | { | 368 | { |
369 | unsigned long addr; | 369 | num_physpages += free_initmem_default(POISON_FREE_INITMEM); |
370 | unsigned long freed; | ||
371 | |||
372 | addr = (unsigned long)(&__init_begin); | ||
373 | freed = (unsigned long)(&__init_end) - addr; | ||
374 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { | ||
375 | struct page *p; | ||
376 | |||
377 | memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE); | ||
378 | p = virt_to_page(addr); | ||
379 | |||
380 | ClearPageReserved(p); | ||
381 | init_page_count(p); | ||
382 | __free_page(p); | ||
383 | totalram_pages++; | ||
384 | num_physpages++; | ||
385 | } | ||
386 | printk(KERN_INFO "Freeing unused kernel memory: %ldk freed\n", | ||
387 | freed >> 10); | ||
388 | } | 370 | } |
389 | 371 | ||
390 | #ifdef CONFIG_BLK_DEV_INITRD | 372 | #ifdef CONFIG_BLK_DEV_INITRD |
391 | void free_initrd_mem(unsigned long start, unsigned long end) | 373 | void free_initrd_mem(unsigned long start, unsigned long end) |
392 | { | 374 | { |
393 | if (start < end) | 375 | num_physpages += free_reserved_area(start, end, POISON_FREE_INITMEM, |
394 | printk(KERN_INFO "Freeing initrd memory: %ldk freed\n", | 376 | "initrd"); |
395 | (end - start) >> 10); | ||
396 | for (; start < end; start += PAGE_SIZE) { | ||
397 | struct page *p; | ||
398 | |||
399 | memset((void *)start, POISON_FREE_INITMEM, PAGE_SIZE); | ||
400 | p = virt_to_page(start); | ||
401 | |||
402 | ClearPageReserved(p); | ||
403 | init_page_count(p); | ||
404 | __free_page(p); | ||
405 | totalram_pages++; | ||
406 | num_physpages++; | ||
407 | } | ||
408 | } | 377 | } |
409 | #endif | 378 | #endif |
410 | 379 | ||