Commit f3beeb4a51d3aa16571e6c3774b929209e9956bf

Authored by Jiang Liu
Committed by Linus Torvalds
1 parent 69afade72a

mm/alpha: use common help functions to free reserved pages

Use common help functions to free reserved pages.  Also include
<asm/sections.h> to avoid local declarations.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 3 changed files with 6 additions and 26 deletions Side-by-side Diff

arch/alpha/kernel/sys_nautilus.c
... ... @@ -185,7 +185,6 @@
185 185 mb();
186 186 }
187 187  
188   -extern void free_reserved_mem(void *, void *);
189 188 extern void pcibios_claim_one_bus(struct pci_bus *);
190 189  
191 190 static struct resource irongate_io = {
... ... @@ -239,8 +238,8 @@
239 238 if (pci_mem < memtop)
240 239 memtop = pci_mem;
241 240 if (memtop > alpha_mv.min_mem_address) {
242   - free_reserved_mem(__va(alpha_mv.min_mem_address),
243   - __va(memtop));
  241 + free_reserved_area((unsigned long)__va(alpha_mv.min_mem_address),
  242 + (unsigned long)__va(memtop), 0, NULL);
244 243 printk("nautilus_init_pci: %ldk freed\n",
245 244 (memtop - alpha_mv.min_mem_address) >> 10);
246 245 }
arch/alpha/mm/init.c
... ... @@ -31,6 +31,7 @@
31 31 #include <asm/console.h>
32 32 #include <asm/tlb.h>
33 33 #include <asm/setup.h>
  34 +#include <asm/sections.h>
34 35  
35 36 extern void die_if_kernel(char *,struct pt_regs *,long);
36 37  
... ... @@ -281,8 +282,6 @@
281 282 {
282 283 unsigned long codesize, reservedpages, datasize, initsize, tmp;
283 284 extern int page_is_ram(unsigned long) __init;
284   - extern char _text, _etext, _data, _edata;
285   - extern char __init_begin, __init_end;
286 285  
287 286 /* printk all informations */
288 287 reservedpages = 0;
289 288  
290 289  
... ... @@ -318,33 +317,16 @@
318 317 #endif /* CONFIG_DISCONTIGMEM */
319 318  
320 319 void
321   -free_reserved_mem(void *start, void *end)
322   -{
323   - void *__start = start;
324   - for (; __start < end; __start += PAGE_SIZE) {
325   - ClearPageReserved(virt_to_page(__start));
326   - init_page_count(virt_to_page(__start));
327   - free_page((long)__start);
328   - totalram_pages++;
329   - }
330   -}
331   -
332   -void
333 320 free_initmem(void)
334 321 {
335   - extern char __init_begin, __init_end;
336   -
337   - free_reserved_mem(&__init_begin, &__init_end);
338   - printk ("Freeing unused kernel memory: %ldk freed\n",
339   - (&__init_end - &__init_begin) >> 10);
  322 + free_initmem_default(0);
340 323 }
341 324  
342 325 #ifdef CONFIG_BLK_DEV_INITRD
343 326 void
344 327 free_initrd_mem(unsigned long start, unsigned long end)
345 328 {
346   - free_reserved_mem((void *)start, (void *)end);
347   - printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
  329 + free_reserved_area(start, end, 0, "initrd");
348 330 }
349 331 #endif
arch/alpha/mm/numa.c
... ... @@ -17,6 +17,7 @@
17 17  
18 18 #include <asm/hwrpb.h>
19 19 #include <asm/pgalloc.h>
  20 +#include <asm/sections.h>
20 21  
21 22 pg_data_t node_data[MAX_NUMNODES];
22 23 EXPORT_SYMBOL(node_data);
... ... @@ -325,8 +326,6 @@
325 326 {
326 327 unsigned long codesize, reservedpages, datasize, initsize, pfn;
327 328 extern int page_is_ram(unsigned long) __init;
328   - extern char _text, _etext, _data, _edata;
329   - extern char __init_begin, __init_end;
330 329 unsigned long nid, i;
331 330 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
332 331