aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin
diff options
context:
space:
mode:
authorJiang Liu <liuj97@gmail.com>2013-04-29 18:06:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 18:54:29 -0400
commited8a36f50381e3d10fa57aba4088d67e9d55b0e5 (patch)
tree755acc3af9bebae4e491f731a7d728cb937595d1 /arch/blackfin
parentc15da0a87c33e32b4984d367799b32dda2024af8 (diff)
mm/blackfin: 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: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/blackfin')
-rw-r--r--arch/blackfin/mm/init.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index 9cb85537bd2b..82d01a71207f 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -103,7 +103,7 @@ void __init mem_init(void)
103 max_mapnr = num_physpages = MAP_NR(high_memory); 103 max_mapnr = num_physpages = MAP_NR(high_memory);
104 printk(KERN_DEBUG "Kernel managed physical pages: %lu\n", num_physpages); 104 printk(KERN_DEBUG "Kernel managed physical pages: %lu\n", num_physpages);
105 105
106 /* This will put all memory onto the freelists. */ 106 /* This will put all low memory onto the freelists. */
107 totalram_pages = free_all_bootmem(); 107 totalram_pages = free_all_bootmem();
108 108
109 reservedpages = 0; 109 reservedpages = 0;
@@ -129,24 +129,11 @@ void __init mem_init(void)
129 initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10))); 129 initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10)));
130} 130}
131 131
132static void __init free_init_pages(const char *what, unsigned long begin, unsigned long end)
133{
134 unsigned long addr;
135 /* next to check that the page we free is not a partial page */
136 for (addr = begin; addr + PAGE_SIZE <= end; addr += PAGE_SIZE) {
137 ClearPageReserved(virt_to_page(addr));
138 init_page_count(virt_to_page(addr));
139 free_page(addr);
140 totalram_pages++;
141 }
142 printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
143}
144
145#ifdef CONFIG_BLK_DEV_INITRD 132#ifdef CONFIG_BLK_DEV_INITRD
146void __init free_initrd_mem(unsigned long start, unsigned long end) 133void __init free_initrd_mem(unsigned long start, unsigned long end)
147{ 134{
148#ifndef CONFIG_MPU 135#ifndef CONFIG_MPU
149 free_init_pages("initrd memory", start, end); 136 free_reserved_area(start, end, 0, "initrd");
150#endif 137#endif
151} 138}
152#endif 139#endif
@@ -154,10 +141,7 @@ void __init free_initrd_mem(unsigned long start, unsigned long end)
154void __init_refok free_initmem(void) 141void __init_refok free_initmem(void)
155{ 142{
156#if defined CONFIG_RAMKERNEL && !defined CONFIG_MPU 143#if defined CONFIG_RAMKERNEL && !defined CONFIG_MPU
157 free_init_pages("unused kernel memory", 144 free_initmem_default(0);
158 (unsigned long)(&__init_begin),
159 (unsigned long)(&__init_end));
160
161 if (memory_start == (unsigned long)(&__init_end)) 145 if (memory_start == (unsigned long)(&__init_end))
162 memory_start = (unsigned long)(&__init_begin); 146 memory_start = (unsigned long)(&__init_begin);
163#endif 147#endif