diff options
author | Jiang Liu <liuj97@gmail.com> | 2013-04-29 18:06:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 18:54:29 -0400 |
commit | f3beeb4a51d3aa16571e6c3774b929209e9956bf (patch) | |
tree | 868eaa96bc60c57e79929fd582dffa9bdde4c900 /arch/alpha | |
parent | 69afade72a3e13e96a065f757891d384d466123f (diff) |
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>
Diffstat (limited to 'arch/alpha')
-rw-r--r-- | arch/alpha/kernel/sys_nautilus.c | 5 | ||||
-rw-r--r-- | arch/alpha/mm/init.c | 24 | ||||
-rw-r--r-- | arch/alpha/mm/numa.c | 3 |
3 files changed, 6 insertions, 26 deletions
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c index 1383f8601a93..1d4aabfcf9a1 100644 --- a/arch/alpha/kernel/sys_nautilus.c +++ b/arch/alpha/kernel/sys_nautilus.c | |||
@@ -185,7 +185,6 @@ nautilus_machine_check(unsigned long vector, unsigned long la_ptr) | |||
185 | mb(); | 185 | mb(); |
186 | } | 186 | } |
187 | 187 | ||
188 | extern void free_reserved_mem(void *, void *); | ||
189 | extern void pcibios_claim_one_bus(struct pci_bus *); | 188 | extern void pcibios_claim_one_bus(struct pci_bus *); |
190 | 189 | ||
191 | static struct resource irongate_io = { | 190 | static struct resource irongate_io = { |
@@ -239,8 +238,8 @@ nautilus_init_pci(void) | |||
239 | if (pci_mem < memtop) | 238 | if (pci_mem < memtop) |
240 | memtop = pci_mem; | 239 | memtop = pci_mem; |
241 | if (memtop > alpha_mv.min_mem_address) { | 240 | if (memtop > alpha_mv.min_mem_address) { |
242 | free_reserved_mem(__va(alpha_mv.min_mem_address), | 241 | free_reserved_area((unsigned long)__va(alpha_mv.min_mem_address), |
243 | __va(memtop)); | 242 | (unsigned long)__va(memtop), 0, NULL); |
244 | printk("nautilus_init_pci: %ldk freed\n", | 243 | printk("nautilus_init_pci: %ldk freed\n", |
245 | (memtop - alpha_mv.min_mem_address) >> 10); | 244 | (memtop - alpha_mv.min_mem_address) >> 10); |
246 | } | 245 | } |
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c index 1ad6ca74bed2..0ba85ee4a466 100644 --- a/arch/alpha/mm/init.c +++ b/arch/alpha/mm/init.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <asm/console.h> | 31 | #include <asm/console.h> |
32 | #include <asm/tlb.h> | 32 | #include <asm/tlb.h> |
33 | #include <asm/setup.h> | 33 | #include <asm/setup.h> |
34 | #include <asm/sections.h> | ||
34 | 35 | ||
35 | extern void die_if_kernel(char *,struct pt_regs *,long); | 36 | extern void die_if_kernel(char *,struct pt_regs *,long); |
36 | 37 | ||
@@ -281,8 +282,6 @@ printk_memory_info(void) | |||
281 | { | 282 | { |
282 | unsigned long codesize, reservedpages, datasize, initsize, tmp; | 283 | unsigned long codesize, reservedpages, datasize, initsize, tmp; |
283 | extern int page_is_ram(unsigned long) __init; | 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 | /* printk all informations */ | 286 | /* printk all informations */ |
288 | reservedpages = 0; | 287 | reservedpages = 0; |
@@ -318,32 +317,15 @@ mem_init(void) | |||
318 | #endif /* CONFIG_DISCONTIGMEM */ | 317 | #endif /* CONFIG_DISCONTIGMEM */ |
319 | 318 | ||
320 | void | 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 | free_initmem(void) | 320 | free_initmem(void) |
334 | { | 321 | { |
335 | extern char __init_begin, __init_end; | 322 | free_initmem_default(0); |
336 | |||
337 | free_reserved_mem(&__init_begin, &__init_end); | ||
338 | printk ("Freeing unused kernel memory: %ldk freed\n", | ||
339 | (&__init_end - &__init_begin) >> 10); | ||
340 | } | 323 | } |
341 | 324 | ||
342 | #ifdef CONFIG_BLK_DEV_INITRD | 325 | #ifdef CONFIG_BLK_DEV_INITRD |
343 | void | 326 | void |
344 | free_initrd_mem(unsigned long start, unsigned long end) | 327 | free_initrd_mem(unsigned long start, unsigned long end) |
345 | { | 328 | { |
346 | free_reserved_mem((void *)start, (void *)end); | 329 | free_reserved_area(start, end, 0, "initrd"); |
347 | printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); | ||
348 | } | 330 | } |
349 | #endif | 331 | #endif |
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c index 3973ae395772..33885048fa36 100644 --- a/arch/alpha/mm/numa.c +++ b/arch/alpha/mm/numa.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <asm/hwrpb.h> | 18 | #include <asm/hwrpb.h> |
19 | #include <asm/pgalloc.h> | 19 | #include <asm/pgalloc.h> |
20 | #include <asm/sections.h> | ||
20 | 21 | ||
21 | pg_data_t node_data[MAX_NUMNODES]; | 22 | pg_data_t node_data[MAX_NUMNODES]; |
22 | EXPORT_SYMBOL(node_data); | 23 | EXPORT_SYMBOL(node_data); |
@@ -325,8 +326,6 @@ void __init mem_init(void) | |||
325 | { | 326 | { |
326 | unsigned long codesize, reservedpages, datasize, initsize, pfn; | 327 | unsigned long codesize, reservedpages, datasize, initsize, pfn; |
327 | extern int page_is_ram(unsigned long) __init; | 328 | extern int page_is_ram(unsigned long) __init; |
328 | extern char _text, _etext, _data, _edata; | ||
329 | extern char __init_begin, __init_end; | ||
330 | unsigned long nid, i; | 329 | unsigned long nid, i; |
331 | high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); | 330 | high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); |
332 | 331 | ||