aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/s390/mm/init.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 765647952221..d5865e4024ce 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -143,33 +143,34 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
143} 143}
144#endif 144#endif
145 145
146void free_initmem(void) 146void free_init_pages(char *what, unsigned long begin, unsigned long end)
147{ 147{
148 unsigned long addr; 148 unsigned long addr = begin;
149 149
150 addr = (unsigned long)(&__init_begin); 150 if (begin >= end)
151 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { 151 return;
152 for (; addr < end; addr += PAGE_SIZE) {
152 ClearPageReserved(virt_to_page(addr)); 153 ClearPageReserved(virt_to_page(addr));
153 init_page_count(virt_to_page(addr)); 154 init_page_count(virt_to_page(addr));
154 memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE); 155 memset((void *)(addr & PAGE_MASK), POISON_FREE_INITMEM,
156 PAGE_SIZE);
155 free_page(addr); 157 free_page(addr);
156 totalram_pages++; 158 totalram_pages++;
157 } 159 }
158 printk ("Freeing unused kernel memory: %ldk freed\n", 160 printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10);
159 ((unsigned long)&__init_end - (unsigned long)&__init_begin) >> 10); 161}
162
163void free_initmem(void)
164{
165 free_init_pages("unused kernel memory",
166 (unsigned long)&__init_begin,
167 (unsigned long)&__init_end);
160} 168}
161 169
162#ifdef CONFIG_BLK_DEV_INITRD 170#ifdef CONFIG_BLK_DEV_INITRD
163void free_initrd_mem(unsigned long start, unsigned long end) 171void free_initrd_mem(unsigned long start, unsigned long end)
164{ 172{
165 if (start < end) 173 free_init_pages("initrd memory", start, end);
166 printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
167 for (; start < end; start += PAGE_SIZE) {
168 ClearPageReserved(virt_to_page(start));
169 init_page_count(virt_to_page(start));
170 free_page(start);
171 totalram_pages++;
172 }
173} 174}
174#endif 175#endif
175 176