diff options
author | Jiang Liu <liuj97@gmail.com> | 2013-04-29 18:06:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 18:54:29 -0400 |
commit | 95a259ed28204c7692fdf902b1742e50efc07c83 (patch) | |
tree | f56f6d3b0bc2f10b2f9abce3ededf127af122763 /arch/c6x | |
parent | ed8a36f50381e3d10fa57aba4088d67e9d55b0e5 (diff) |
mm/c6x: 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>
Cc: Mark Salter <msalter@redhat.com>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/c6x')
-rw-r--r-- | arch/c6x/mm/init.c | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/arch/c6x/mm/init.c b/arch/c6x/mm/init.c index 89395f09648a..a9fcd89b251b 100644 --- a/arch/c6x/mm/init.c +++ b/arch/c6x/mm/init.c | |||
@@ -77,37 +77,11 @@ void __init mem_init(void) | |||
77 | #ifdef CONFIG_BLK_DEV_INITRD | 77 | #ifdef CONFIG_BLK_DEV_INITRD |
78 | void __init free_initrd_mem(unsigned long start, unsigned long end) | 78 | void __init free_initrd_mem(unsigned long start, unsigned long end) |
79 | { | 79 | { |
80 | int pages = 0; | 80 | free_reserved_area(start, end, 0, "initrd"); |
81 | for (; start < end; start += PAGE_SIZE) { | ||
82 | ClearPageReserved(virt_to_page(start)); | ||
83 | init_page_count(virt_to_page(start)); | ||
84 | free_page(start); | ||
85 | totalram_pages++; | ||
86 | pages++; | ||
87 | } | ||
88 | printk(KERN_INFO "Freeing initrd memory: %luk freed\n", | ||
89 | (pages * PAGE_SIZE) >> 10); | ||
90 | } | 81 | } |
91 | #endif | 82 | #endif |
92 | 83 | ||
93 | void __init free_initmem(void) | 84 | void __init free_initmem(void) |
94 | { | 85 | { |
95 | unsigned long addr; | 86 | free_initmem_default(0); |
96 | |||
97 | /* | ||
98 | * The following code should be cool even if these sections | ||
99 | * are not page aligned. | ||
100 | */ | ||
101 | addr = PAGE_ALIGN((unsigned long)(__init_begin)); | ||
102 | |||
103 | /* next to check that the page we free is not a partial page */ | ||
104 | for (; addr + PAGE_SIZE < (unsigned long)(__init_end); | ||
105 | addr += PAGE_SIZE) { | ||
106 | ClearPageReserved(virt_to_page(addr)); | ||
107 | init_page_count(virt_to_page(addr)); | ||
108 | free_page(addr); | ||
109 | totalram_pages++; | ||
110 | } | ||
111 | printk(KERN_INFO "Freeing unused kernel memory: %dK freed\n", | ||
112 | (int) ((addr - PAGE_ALIGN((long) &__init_begin)) >> 10)); | ||
113 | } | 87 | } |