aboutsummaryrefslogtreecommitdiffstats
path: root/arch/score/mm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/score/mm')
-rw-r--r--arch/score/mm/init.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/arch/score/mm/init.c b/arch/score/mm/init.c
index 8b6f796c6ade..d8f988a37d16 100644
--- a/arch/score/mm/init.c
+++ b/arch/score/mm/init.c
@@ -43,7 +43,7 @@ EXPORT_SYMBOL_GPL(empty_zero_page);
43 43
44static struct kcore_list kcore_mem, kcore_vmalloc; 44static struct kcore_list kcore_mem, kcore_vmalloc;
45 45
46static unsigned long setup_zero_page(void) 46static void setup_zero_page(void)
47{ 47{
48 struct page *page; 48 struct page *page;
49 49
@@ -52,9 +52,7 @@ static unsigned long setup_zero_page(void)
52 panic("Oh boy, that early out of memory?"); 52 panic("Oh boy, that early out of memory?");
53 53
54 page = virt_to_page((void *) empty_zero_page); 54 page = virt_to_page((void *) empty_zero_page);
55 SetPageReserved(page); 55 mark_page_reserved(page);
56
57 return 1UL;
58} 56}
59 57
60#ifndef CONFIG_NEED_MULTIPLE_NODES 58#ifndef CONFIG_NEED_MULTIPLE_NODES
@@ -84,7 +82,7 @@ void __init mem_init(void)
84 82
85 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); 83 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
86 totalram_pages += free_all_bootmem(); 84 totalram_pages += free_all_bootmem();
87 totalram_pages -= setup_zero_page(); /* Setup zeroed pages. */ 85 setup_zero_page(); /* Setup zeroed pages. */
88 reservedpages = 0; 86 reservedpages = 0;
89 87
90 for (tmp = 0; tmp < max_low_pfn; tmp++) 88 for (tmp = 0; tmp < max_low_pfn; tmp++)
@@ -109,37 +107,16 @@ void __init mem_init(void)
109} 107}
110#endif /* !CONFIG_NEED_MULTIPLE_NODES */ 108#endif /* !CONFIG_NEED_MULTIPLE_NODES */
111 109
112static void free_init_pages(const char *what, unsigned long begin, unsigned long end)
113{
114 unsigned long pfn;
115
116 for (pfn = PFN_UP(begin); pfn < PFN_DOWN(end); pfn++) {
117 struct page *page = pfn_to_page(pfn);
118 void *addr = phys_to_virt(PFN_PHYS(pfn));
119
120 ClearPageReserved(page);
121 init_page_count(page);
122 memset(addr, POISON_FREE_INITMEM, PAGE_SIZE);
123 __free_page(page);
124 totalram_pages++;
125 }
126 printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
127}
128
129#ifdef CONFIG_BLK_DEV_INITRD 110#ifdef CONFIG_BLK_DEV_INITRD
130void free_initrd_mem(unsigned long start, unsigned long end) 111void free_initrd_mem(unsigned long start, unsigned long end)
131{ 112{
132 free_init_pages("initrd memory", 113 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd");
133 virt_to_phys((void *) start),
134 virt_to_phys((void *) end));
135} 114}
136#endif 115#endif
137 116
138void __init_refok free_initmem(void) 117void __init_refok free_initmem(void)
139{ 118{
140 free_init_pages("unused kernel memory", 119 free_initmem_default(POISON_FREE_INITMEM);
141 __pa(&__init_begin),
142 __pa(&__init_end));
143} 120}
144 121
145unsigned long pgd_current; 122unsigned long pgd_current;