Commit f3beeb4a authored by Jiang Liu's avatar Jiang Liu Committed by Linus Torvalds

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: default avatarJiang 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 69afade7
...@@ -185,7 +185,6 @@ nautilus_machine_check(unsigned long vector, unsigned long la_ptr) ...@@ -185,7 +185,6 @@ nautilus_machine_check(unsigned long vector, unsigned long la_ptr)
mb(); mb();
} }
extern void free_reserved_mem(void *, void *);
extern void pcibios_claim_one_bus(struct pci_bus *); extern void pcibios_claim_one_bus(struct pci_bus *);
static struct resource irongate_io = { static struct resource irongate_io = {
...@@ -239,8 +238,8 @@ nautilus_init_pci(void) ...@@ -239,8 +238,8 @@ nautilus_init_pci(void)
if (pci_mem < memtop) if (pci_mem < memtop)
memtop = pci_mem; memtop = pci_mem;
if (memtop > alpha_mv.min_mem_address) { if (memtop > alpha_mv.min_mem_address) {
free_reserved_mem(__va(alpha_mv.min_mem_address), free_reserved_area((unsigned long)__va(alpha_mv.min_mem_address),
__va(memtop)); (unsigned long)__va(memtop), 0, NULL);
printk("nautilus_init_pci: %ldk freed\n", printk("nautilus_init_pci: %ldk freed\n",
(memtop - alpha_mv.min_mem_address) >> 10); (memtop - alpha_mv.min_mem_address) >> 10);
} }
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <asm/console.h> #include <asm/console.h>
#include <asm/tlb.h> #include <asm/tlb.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/sections.h>
extern void die_if_kernel(char *,struct pt_regs *,long); extern void die_if_kernel(char *,struct pt_regs *,long);
...@@ -281,8 +282,6 @@ printk_memory_info(void) ...@@ -281,8 +282,6 @@ printk_memory_info(void)
{ {
unsigned long codesize, reservedpages, datasize, initsize, tmp; unsigned long codesize, reservedpages, datasize, initsize, tmp;
extern int page_is_ram(unsigned long) __init; extern int page_is_ram(unsigned long) __init;
extern char _text, _etext, _data, _edata;
extern char __init_begin, __init_end;
/* printk all informations */ /* printk all informations */
reservedpages = 0; reservedpages = 0;
...@@ -317,33 +316,16 @@ mem_init(void) ...@@ -317,33 +316,16 @@ mem_init(void)
} }
#endif /* CONFIG_DISCONTIGMEM */ #endif /* CONFIG_DISCONTIGMEM */
void
free_reserved_mem(void *start, void *end)
{
void *__start = start;
for (; __start < end; __start += PAGE_SIZE) {
ClearPageReserved(virt_to_page(__start));
init_page_count(virt_to_page(__start));
free_page((long)__start);
totalram_pages++;
}
}
void void
free_initmem(void) free_initmem(void)
{ {
extern char __init_begin, __init_end; free_initmem_default(0);
free_reserved_mem(&__init_begin, &__init_end);
printk ("Freeing unused kernel memory: %ldk freed\n",
(&__init_end - &__init_begin) >> 10);
} }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
void void
free_initrd_mem(unsigned long start, unsigned long end) free_initrd_mem(unsigned long start, unsigned long end)
{ {
free_reserved_mem((void *)start, (void *)end); free_reserved_area(start, end, 0, "initrd");
printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
} }
#endif #endif
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <asm/hwrpb.h> #include <asm/hwrpb.h>
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
#include <asm/sections.h>
pg_data_t node_data[MAX_NUMNODES]; pg_data_t node_data[MAX_NUMNODES];
EXPORT_SYMBOL(node_data); EXPORT_SYMBOL(node_data);
...@@ -325,8 +326,6 @@ void __init mem_init(void) ...@@ -325,8 +326,6 @@ void __init mem_init(void)
{ {
unsigned long codesize, reservedpages, datasize, initsize, pfn; unsigned long codesize, reservedpages, datasize, initsize, pfn;
extern int page_is_ram(unsigned long) __init; extern int page_is_ram(unsigned long) __init;
extern char _text, _etext, _data, _edata;
extern char __init_begin, __init_end;
unsigned long nid, i; unsigned long nid, i;
high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment