aboutsummaryrefslogtreecommitdiffstats
path: root/arch/frv
diff options
context:
space:
mode:
authorJiang Liu <liuj97@gmail.com>2013-04-29 18:06:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 18:54:29 -0400
commit0516f8845231c938c189690a4ad55c985e8115f3 (patch)
tree29686fc5285c71c14268048368ce0fe7b62fc3c0 /arch/frv
parent2e529815a65a7c7ea61cad0b38e50967a2eb1677 (diff)
mm/FRV: 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: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/frv')
-rw-r--r--arch/frv/mm/init.c34
1 files changed, 4 insertions, 30 deletions
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index 92e97b0894a6..21b92904f4c4 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -122,7 +122,7 @@ void __init mem_init(void)
122#endif 122#endif
123 int codek = 0, datak = 0; 123 int codek = 0, datak = 0;
124 124
125 /* this will put all memory onto the freelists */ 125 /* this will put all low memory onto the freelists */
126 totalram_pages = free_all_bootmem(); 126 totalram_pages = free_all_bootmem();
127 127
128#ifdef CONFIG_MMU 128#ifdef CONFIG_MMU
@@ -132,11 +132,7 @@ void __init mem_init(void)
132 132
133#ifdef CONFIG_HIGHMEM 133#ifdef CONFIG_HIGHMEM
134 for (pfn = num_physpages - 1; pfn >= num_mappedpages; pfn--) { 134 for (pfn = num_physpages - 1; pfn >= num_mappedpages; pfn--) {
135 struct page *page = &mem_map[pfn]; 135 __free_reserved_page(&mem_map[pfn]);
136
137 ClearPageReserved(page);
138 init_page_count(page);
139 __free_page(page);
140 totalram_pages++; 136 totalram_pages++;
141 } 137 }
142#endif 138#endif
@@ -168,21 +164,7 @@ void __init mem_init(void)
168void free_initmem(void) 164void free_initmem(void)
169{ 165{
170#if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL) 166#if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL)
171 unsigned long start, end, addr; 167 free_initmem_default(0);
172
173 start = PAGE_ALIGN((unsigned long) &__init_begin); /* round up */
174 end = ((unsigned long) &__init_end) & PAGE_MASK; /* round down */
175
176 /* next to check that the page we free is not a partial page */
177 for (addr = start; addr < end; addr += PAGE_SIZE) {
178 ClearPageReserved(virt_to_page(addr));
179 init_page_count(virt_to_page(addr));
180 free_page(addr);
181 totalram_pages++;
182 }
183
184 printk("Freeing unused kernel memory: %ldKiB freed (0x%lx - 0x%lx)\n",
185 (end - start) >> 10, start, end);
186#endif 168#endif
187} /* end free_initmem() */ 169} /* end free_initmem() */
188 170
@@ -193,14 +175,6 @@ void free_initmem(void)
193#ifdef CONFIG_BLK_DEV_INITRD 175#ifdef CONFIG_BLK_DEV_INITRD
194void __init free_initrd_mem(unsigned long start, unsigned long end) 176void __init free_initrd_mem(unsigned long start, unsigned long end)
195{ 177{
196 int pages = 0; 178 free_reserved_area(start, end, 0, "initrd");
197 for (; start < end; start += PAGE_SIZE) {
198 ClearPageReserved(virt_to_page(start));
199 init_page_count(virt_to_page(start));
200 free_page(start);
201 totalram_pages++;
202 pages++;
203 }
204 printk("Freeing initrd memory: %dKiB freed\n", (pages * PAGE_SIZE) >> 10);
205} /* end free_initrd_mem() */ 179} /* end free_initrd_mem() */
206#endif 180#endif