diff options
author | Jiang Liu <liuj97@gmail.com> | 2013-04-29 18:06:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 18:54:29 -0400 |
commit | 0f97580da0ead5cfda2d67afcc8571a86b303516 (patch) | |
tree | 97e0796d2c18f28be2a2b0e4360acd7ca99bd908 /arch/h8300 | |
parent | 0516f8845231c938c189690a4ad55c985e8115f3 (diff) |
mm/h8300: 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: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/h8300')
-rw-r--r-- | arch/h8300/mm/init.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c index 981e25094b1a..ff349d70a29b 100644 --- a/arch/h8300/mm/init.c +++ b/arch/h8300/mm/init.c | |||
@@ -139,7 +139,7 @@ void __init mem_init(void) | |||
139 | start_mem = PAGE_ALIGN(start_mem); | 139 | start_mem = PAGE_ALIGN(start_mem); |
140 | max_mapnr = num_physpages = MAP_NR(high_memory); | 140 | max_mapnr = num_physpages = MAP_NR(high_memory); |
141 | 141 | ||
142 | /* this will put all memory onto the freelists */ | 142 | /* this will put all low memory onto the freelists */ |
143 | totalram_pages = free_all_bootmem(); | 143 | totalram_pages = free_all_bootmem(); |
144 | 144 | ||
145 | codek = (_etext - _stext) >> 10; | 145 | codek = (_etext - _stext) >> 10; |
@@ -161,15 +161,7 @@ void __init mem_init(void) | |||
161 | #ifdef CONFIG_BLK_DEV_INITRD | 161 | #ifdef CONFIG_BLK_DEV_INITRD |
162 | void free_initrd_mem(unsigned long start, unsigned long end) | 162 | void free_initrd_mem(unsigned long start, unsigned long end) |
163 | { | 163 | { |
164 | int pages = 0; | 164 | free_reserved_area(start, end, 0, "initrd"); |
165 | for (; start < end; start += PAGE_SIZE) { | ||
166 | ClearPageReserved(virt_to_page(start)); | ||
167 | init_page_count(virt_to_page(start)); | ||
168 | free_page(start); | ||
169 | totalram_pages++; | ||
170 | pages++; | ||
171 | } | ||
172 | printk ("Freeing initrd memory: %dk freed\n", pages); | ||
173 | } | 165 | } |
174 | #endif | 166 | #endif |
175 | 167 | ||
@@ -177,23 +169,7 @@ void | |||
177 | free_initmem(void) | 169 | free_initmem(void) |
178 | { | 170 | { |
179 | #ifdef CONFIG_RAMKERNEL | 171 | #ifdef CONFIG_RAMKERNEL |
180 | unsigned long addr; | 172 | free_initmem_default(0); |
181 | /* | ||
182 | * the following code should be cool even if these sections | ||
183 | * are not page aligned. | ||
184 | */ | ||
185 | addr = PAGE_ALIGN((unsigned long)(__init_begin)); | ||
186 | /* next to check that the page we free is not a partial page */ | ||
187 | for (; addr + PAGE_SIZE < (unsigned long)__init_end; addr +=PAGE_SIZE) { | ||
188 | ClearPageReserved(virt_to_page(addr)); | ||
189 | init_page_count(virt_to_page(addr)); | ||
190 | free_page(addr); | ||
191 | totalram_pages++; | ||
192 | } | ||
193 | printk(KERN_INFO "Freeing unused kernel memory: %ldk freed (0x%x - 0x%x)\n", | ||
194 | (addr - PAGE_ALIGN((long) __init_begin)) >> 10, | ||
195 | (int)(PAGE_ALIGN((unsigned long)__init_begin)), | ||
196 | (int)(addr - PAGE_SIZE)); | ||
197 | #endif | 173 | #endif |
198 | } | 174 | } |
199 | 175 | ||