aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/kernel/sys_nautilus.c2
-rw-r--r--arch/alpha/mm/init.c4
-rw-r--r--arch/arc/mm/init.c4
-rw-r--r--arch/arm/mm/init.c8
-rw-r--r--arch/arm64/mm/init.c4
-rw-r--r--arch/avr32/mm/init.c4
-rw-r--r--arch/blackfin/mm/init.c4
-rw-r--r--arch/c6x/mm/init.c4
-rw-r--r--arch/cris/mm/init.c2
-rw-r--r--arch/frv/mm/init.c4
-rw-r--r--arch/h8300/mm/init.c4
-rw-r--r--arch/ia64/mm/init.c2
-rw-r--r--arch/m32r/mm/init.c4
-rw-r--r--arch/m68k/mm/init.c4
-rw-r--r--arch/microblaze/mm/init.c4
-rw-r--r--arch/openrisc/mm/init.c4
-rw-r--r--arch/parisc/mm/init.c4
-rw-r--r--arch/powerpc/kernel/kvm.c9
-rw-r--r--arch/powerpc/mm/mem.c2
-rw-r--r--arch/s390/mm/init.c2
-rw-r--r--arch/sh/mm/init.c4
-rw-r--r--arch/um/kernel/mem.c2
-rw-r--r--arch/unicore32/mm/init.c4
-rw-r--r--arch/xtensa/mm/init.c4
-rw-r--r--include/linux/mm.h7
-rw-r--r--mm/page_alloc.c2
26 files changed, 49 insertions, 53 deletions
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 891bd274ccb5..837c0fa58317 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -239,7 +239,7 @@ nautilus_init_pci(void)
239 memtop = pci_mem; 239 memtop = pci_mem;
240 if (memtop > alpha_mv.min_mem_address) { 240 if (memtop > alpha_mv.min_mem_address) {
241 free_reserved_area(__va(alpha_mv.min_mem_address), 241 free_reserved_area(__va(alpha_mv.min_mem_address),
242 __va(memtop), 0, NULL); 242 __va(memtop), -1, NULL);
243 printk("nautilus_init_pci: %ldk freed\n", 243 printk("nautilus_init_pci: %ldk freed\n",
244 (memtop - alpha_mv.min_mem_address) >> 10); 244 (memtop - alpha_mv.min_mem_address) >> 10);
245 } 245 }
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index d54848d4e464..218c29c14bb3 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -319,13 +319,13 @@ mem_init(void)
319void 319void
320free_initmem(void) 320free_initmem(void)
321{ 321{
322 free_initmem_default(0); 322 free_initmem_default(-1);
323} 323}
324 324
325#ifdef CONFIG_BLK_DEV_INITRD 325#ifdef CONFIG_BLK_DEV_INITRD
326void 326void
327free_initrd_mem(unsigned long start, unsigned long end) 327free_initrd_mem(unsigned long start, unsigned long end)
328{ 328{
329 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 329 free_reserved_area((void *)start, (void *)end, -1, "initrd");
330} 330}
331#endif 331#endif
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index dce02e4716a1..f9c707712096 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -146,13 +146,13 @@ void __init mem_init(void)
146 */ 146 */
147void __init_refok free_initmem(void) 147void __init_refok free_initmem(void)
148{ 148{
149 free_initmem_default(0); 149 free_initmem_default(-1);
150} 150}
151 151
152#ifdef CONFIG_BLK_DEV_INITRD 152#ifdef CONFIG_BLK_DEV_INITRD
153void __init free_initrd_mem(unsigned long start, unsigned long end) 153void __init free_initrd_mem(unsigned long start, unsigned long end)
154{ 154{
155 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 155 free_reserved_area((void *)start, (void *)end, -1, "initrd");
156} 156}
157#endif 157#endif
158 158
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 7fae391caf86..2070651c1bb4 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -601,7 +601,7 @@ void __init mem_init(void)
601 601
602#ifdef CONFIG_SA1111 602#ifdef CONFIG_SA1111
603 /* now that our DMA memory is actually so designated, we can free it */ 603 /* now that our DMA memory is actually so designated, we can free it */
604 free_reserved_area(__va(PHYS_PFN_OFFSET), swapper_pg_dir, 0, NULL); 604 free_reserved_area(__va(PHYS_PFN_OFFSET), swapper_pg_dir, -1, NULL);
605#endif 605#endif
606 606
607 free_highpages(); 607 free_highpages();
@@ -729,12 +729,12 @@ void free_initmem(void)
729 extern char __tcm_start, __tcm_end; 729 extern char __tcm_start, __tcm_end;
730 730
731 poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start); 731 poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start);
732 free_reserved_area(&__tcm_start, &__tcm_end, 0, "TCM link"); 732 free_reserved_area(&__tcm_start, &__tcm_end, -1, "TCM link");
733#endif 733#endif
734 734
735 poison_init_mem(__init_begin, __init_end - __init_begin); 735 poison_init_mem(__init_begin, __init_end - __init_begin);
736 if (!machine_is_integrator() && !machine_is_cintegrator()) 736 if (!machine_is_integrator() && !machine_is_cintegrator())
737 free_initmem_default(0); 737 free_initmem_default(-1);
738} 738}
739 739
740#ifdef CONFIG_BLK_DEV_INITRD 740#ifdef CONFIG_BLK_DEV_INITRD
@@ -745,7 +745,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
745{ 745{
746 if (!keep_initrd) { 746 if (!keep_initrd) {
747 poison_init_mem((void *)start, PAGE_ALIGN(end) - start); 747 poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
748 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 748 free_reserved_area((void *)start, (void *)end, -1, "initrd");
749 } 749 }
750} 750}
751 751
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 6041e4008a83..997c6345cdd6 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -387,7 +387,7 @@ void __init mem_init(void)
387void free_initmem(void) 387void free_initmem(void)
388{ 388{
389 poison_init_mem(__init_begin, __init_end - __init_begin); 389 poison_init_mem(__init_begin, __init_end - __init_begin);
390 free_initmem_default(0); 390 free_initmem_default(-1);
391} 391}
392 392
393#ifdef CONFIG_BLK_DEV_INITRD 393#ifdef CONFIG_BLK_DEV_INITRD
@@ -398,7 +398,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
398{ 398{
399 if (!keep_initrd) { 399 if (!keep_initrd) {
400 poison_init_mem((void *)start, PAGE_ALIGN(end) - start); 400 poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
401 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 401 free_reserved_area((void *)start, (void *)end, -1, "initrd");
402 } 402 }
403} 403}
404 404
diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c
index 5a79fa08cb3c..b079e04f6954 100644
--- a/arch/avr32/mm/init.c
+++ b/arch/avr32/mm/init.c
@@ -148,12 +148,12 @@ void __init mem_init(void)
148 148
149void free_initmem(void) 149void free_initmem(void)
150{ 150{
151 free_initmem_default(0); 151 free_initmem_default(-1);
152} 152}
153 153
154#ifdef CONFIG_BLK_DEV_INITRD 154#ifdef CONFIG_BLK_DEV_INITRD
155void free_initrd_mem(unsigned long start, unsigned long end) 155void free_initrd_mem(unsigned long start, unsigned long end)
156{ 156{
157 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 157 free_reserved_area((void *)start, (void *)end, -1, "initrd");
158} 158}
159#endif 159#endif
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index 8e9eab272811..fa241f5a7dcf 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -133,7 +133,7 @@ void __init mem_init(void)
133void __init free_initrd_mem(unsigned long start, unsigned long end) 133void __init free_initrd_mem(unsigned long start, unsigned long end)
134{ 134{
135#ifndef CONFIG_MPU 135#ifndef CONFIG_MPU
136 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 136 free_reserved_area((void *)start, (void *)end, -1, "initrd");
137#endif 137#endif
138} 138}
139#endif 139#endif
@@ -141,7 +141,7 @@ void __init free_initrd_mem(unsigned long start, unsigned long end)
141void __init_refok free_initmem(void) 141void __init_refok free_initmem(void)
142{ 142{
143#if defined CONFIG_RAMKERNEL && !defined CONFIG_MPU 143#if defined CONFIG_RAMKERNEL && !defined CONFIG_MPU
144 free_initmem_default(0); 144 free_initmem_default(-1);
145 if (memory_start == (unsigned long)(&__init_end)) 145 if (memory_start == (unsigned long)(&__init_end))
146 memory_start = (unsigned long)(&__init_begin); 146 memory_start = (unsigned long)(&__init_begin);
147#endif 147#endif
diff --git a/arch/c6x/mm/init.c b/arch/c6x/mm/init.c
index 07bfcc98a3b7..3987a20fdee6 100644
--- a/arch/c6x/mm/init.c
+++ b/arch/c6x/mm/init.c
@@ -78,11 +78,11 @@ void __init mem_init(void)
78#ifdef CONFIG_BLK_DEV_INITRD 78#ifdef CONFIG_BLK_DEV_INITRD
79void __init free_initrd_mem(unsigned long start, unsigned long end) 79void __init free_initrd_mem(unsigned long start, unsigned long end)
80{ 80{
81 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 81 free_reserved_area((void *)start, (void *)end, -1, "initrd");
82} 82}
83#endif 83#endif
84 84
85void __init free_initmem(void) 85void __init free_initmem(void)
86{ 86{
87 free_initmem_default(0); 87 free_initmem_default(-1);
88} 88}
diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c
index 9ac80946dada..8fec26392ae7 100644
--- a/arch/cris/mm/init.c
+++ b/arch/cris/mm/init.c
@@ -65,5 +65,5 @@ mem_init(void)
65void 65void
66free_initmem(void) 66free_initmem(void)
67{ 67{
68 free_initmem_default(0); 68 free_initmem_default(-1);
69} 69}
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index a67f3a5897b8..8ba9d22d0d91 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -162,7 +162,7 @@ void __init mem_init(void)
162void free_initmem(void) 162void free_initmem(void)
163{ 163{
164#if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL) 164#if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL)
165 free_initmem_default(0); 165 free_initmem_default(-1);
166#endif 166#endif
167} /* end free_initmem() */ 167} /* end free_initmem() */
168 168
@@ -173,6 +173,6 @@ void free_initmem(void)
173#ifdef CONFIG_BLK_DEV_INITRD 173#ifdef CONFIG_BLK_DEV_INITRD
174void __init free_initrd_mem(unsigned long start, unsigned long end) 174void __init free_initrd_mem(unsigned long start, unsigned long end)
175{ 175{
176 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 176 free_reserved_area((void *)start, (void *)end, -1, "initrd");
177} /* end free_initrd_mem() */ 177} /* end free_initrd_mem() */
178#endif 178#endif
diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c
index 57e03c59861d..c831f1dba132 100644
--- a/arch/h8300/mm/init.c
+++ b/arch/h8300/mm/init.c
@@ -161,7 +161,7 @@ void __init mem_init(void)
161#ifdef CONFIG_BLK_DEV_INITRD 161#ifdef CONFIG_BLK_DEV_INITRD
162void free_initrd_mem(unsigned long start, unsigned long end) 162void free_initrd_mem(unsigned long start, unsigned long end)
163{ 163{
164 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 164 free_reserved_area((void *)start, (void *)end, -1, "initrd");
165} 165}
166#endif 166#endif
167 167
@@ -169,7 +169,7 @@ void
169free_initmem(void) 169free_initmem(void)
170{ 170{
171#ifdef CONFIG_RAMKERNEL 171#ifdef CONFIG_RAMKERNEL
172 free_initmem_default(0); 172 free_initmem_default(-1);
173#endif 173#endif
174} 174}
175 175
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index da568c2e839f..f8a4f38b0ad5 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -155,7 +155,7 @@ void
155free_initmem (void) 155free_initmem (void)
156{ 156{
157 free_reserved_area(ia64_imva(__init_begin), ia64_imva(__init_end), 157 free_reserved_area(ia64_imva(__init_begin), ia64_imva(__init_end),
158 0, "unused kernel"); 158 -1, "unused kernel");
159} 159}
160 160
161void __init 161void __init
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c
index d80412d0c14e..cca87d918436 100644
--- a/arch/m32r/mm/init.c
+++ b/arch/m32r/mm/init.c
@@ -181,7 +181,7 @@ void __init mem_init(void)
181 *======================================================================*/ 181 *======================================================================*/
182void free_initmem(void) 182void free_initmem(void)
183{ 183{
184 free_initmem_default(0); 184 free_initmem_default(-1);
185} 185}
186 186
187#ifdef CONFIG_BLK_DEV_INITRD 187#ifdef CONFIG_BLK_DEV_INITRD
@@ -191,6 +191,6 @@ void free_initmem(void)
191 *======================================================================*/ 191 *======================================================================*/
192void free_initrd_mem(unsigned long start, unsigned long end) 192void free_initrd_mem(unsigned long start, unsigned long end)
193{ 193{
194 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 194 free_reserved_area((void *)start, (void *)end, -1, "initrd");
195} 195}
196#endif 196#endif
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 95de725534e9..ab0b54ca5d85 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -110,7 +110,7 @@ void __init paging_init(void)
110void free_initmem(void) 110void free_initmem(void)
111{ 111{
112#ifndef CONFIG_MMU_SUN3 112#ifndef CONFIG_MMU_SUN3
113 free_initmem_default(0); 113 free_initmem_default(-1);
114#endif /* CONFIG_MMU_SUN3 */ 114#endif /* CONFIG_MMU_SUN3 */
115} 115}
116 116
@@ -202,6 +202,6 @@ void __init mem_init(void)
202#ifdef CONFIG_BLK_DEV_INITRD 202#ifdef CONFIG_BLK_DEV_INITRD
203void free_initrd_mem(unsigned long start, unsigned long end) 203void free_initrd_mem(unsigned long start, unsigned long end)
204{ 204{
205 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 205 free_reserved_area((void *)start, (void *)end, -1, "initrd");
206} 206}
207#endif 207#endif
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index d7b8ada9345f..d149e0ebb767 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -235,13 +235,13 @@ void __init setup_memory(void)
235#ifdef CONFIG_BLK_DEV_INITRD 235#ifdef CONFIG_BLK_DEV_INITRD
236void free_initrd_mem(unsigned long start, unsigned long end) 236void free_initrd_mem(unsigned long start, unsigned long end)
237{ 237{
238 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 238 free_reserved_area((void *)start, (void *)end, -1, "initrd");
239} 239}
240#endif 240#endif
241 241
242void free_initmem(void) 242void free_initmem(void)
243{ 243{
244 free_initmem_default(0); 244 free_initmem_default(-1);
245} 245}
246 246
247void __init mem_init(void) 247void __init mem_init(void)
diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c
index ab113325dc4c..c371e4a0fcac 100644
--- a/arch/openrisc/mm/init.c
+++ b/arch/openrisc/mm/init.c
@@ -261,11 +261,11 @@ void __init mem_init(void)
261#ifdef CONFIG_BLK_DEV_INITRD 261#ifdef CONFIG_BLK_DEV_INITRD
262void free_initrd_mem(unsigned long start, unsigned long end) 262void free_initrd_mem(unsigned long start, unsigned long end)
263{ 263{
264 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 264 free_reserved_area((void *)start, (void *)end, -1, "initrd");
265} 265}
266#endif 266#endif
267 267
268void free_initmem(void) 268void free_initmem(void)
269{ 269{
270 free_initmem_default(0); 270 free_initmem_default(-1);
271} 271}
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 3223d5e4a372..ebac7bd76b56 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -532,7 +532,7 @@ void free_initmem(void)
532 * pages are no-longer executable */ 532 * pages are no-longer executable */
533 flush_icache_range(init_begin, init_end); 533 flush_icache_range(init_begin, init_end);
534 534
535 num_physpages += free_initmem_default(0); 535 num_physpages += free_initmem_default(-1);
536 536
537 /* set up a new led state on systems shipped LED State panel */ 537 /* set up a new led state on systems shipped LED State panel */
538 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE); 538 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE);
@@ -1101,7 +1101,7 @@ void flush_tlb_all(void)
1101#ifdef CONFIG_BLK_DEV_INITRD 1101#ifdef CONFIG_BLK_DEV_INITRD
1102void free_initrd_mem(unsigned long start, unsigned long end) 1102void free_initrd_mem(unsigned long start, unsigned long end)
1103{ 1103{
1104 num_physpages += free_reserved_area((void *)start, (void *)end, 0, 1104 num_physpages += free_reserved_area((void *)start, (void *)end, -1,
1105 "initrd"); 1105 "initrd");
1106} 1106}
1107#endif 1107#endif
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 5e4830a33c08..db28032e320e 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -750,13 +750,8 @@ EXPORT_SYMBOL_GPL(kvm_hypercall);
750 750
751static __init void kvm_free_tmp(void) 751static __init void kvm_free_tmp(void)
752{ 752{
753 unsigned long start, end; 753 free_reserved_area(&kvm_tmp[kvm_tmp_index],
754 754 &kvm_tmp[ARRAY_SIZE(kvm_tmp)], -1, NULL);
755 start = (ulong)&kvm_tmp[kvm_tmp_index + (PAGE_SIZE - 1)] & PAGE_MASK;
756 end = (ulong)&kvm_tmp[ARRAY_SIZE(kvm_tmp)] & PAGE_MASK;
757
758 /* Free the tmp space we don't need */
759 free_reserved_area((void *)start, (void *)end, 0, NULL);
760} 755}
761 756
762static int __init kvm_guest_init(void) 757static int __init kvm_guest_init(void)
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 347c5b1bbd62..7f47a05f55af 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -407,7 +407,7 @@ void free_initmem(void)
407#ifdef CONFIG_BLK_DEV_INITRD 407#ifdef CONFIG_BLK_DEV_INITRD
408void __init free_initrd_mem(unsigned long start, unsigned long end) 408void __init free_initrd_mem(unsigned long start, unsigned long end)
409{ 409{
410 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 410 free_reserved_area((void *)start, (void *)end, -1, "initrd");
411} 411}
412#endif 412#endif
413 413
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 0878c89fe7d2..bf01d18422ec 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -166,7 +166,7 @@ void __init mem_init(void)
166 166
167void free_initmem(void) 167void free_initmem(void)
168{ 168{
169 free_initmem_default(0); 169 free_initmem_default(POISON_FREE_INITMEM);
170} 170}
171 171
172#ifdef CONFIG_BLK_DEV_INITRD 172#ifdef CONFIG_BLK_DEV_INITRD
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index b892a9b7d7e3..d3af56b7a098 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -499,13 +499,13 @@ void __init mem_init(void)
499 499
500void free_initmem(void) 500void free_initmem(void)
501{ 501{
502 free_initmem_default(0); 502 free_initmem_default(-1);
503} 503}
504 504
505#ifdef CONFIG_BLK_DEV_INITRD 505#ifdef CONFIG_BLK_DEV_INITRD
506void free_initrd_mem(unsigned long start, unsigned long end) 506void free_initrd_mem(unsigned long start, unsigned long end)
507{ 507{
508 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 508 free_reserved_area((void *)start, (void *)end, -1, "initrd");
509} 509}
510#endif 510#endif
511 511
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 2aa7a2448d58..8ff0b7ae8ec0 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -244,7 +244,7 @@ void free_initmem(void)
244#ifdef CONFIG_BLK_DEV_INITRD 244#ifdef CONFIG_BLK_DEV_INITRD
245void free_initrd_mem(unsigned long start, unsigned long end) 245void free_initrd_mem(unsigned long start, unsigned long end)
246{ 246{
247 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 247 free_reserved_area((void *)start, (void *)end, -1, "initrd");
248} 248}
249#endif 249#endif
250 250
diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c
index 220755cc9700..df9b8abcb6a5 100644
--- a/arch/unicore32/mm/init.c
+++ b/arch/unicore32/mm/init.c
@@ -476,7 +476,7 @@ void __init mem_init(void)
476 476
477void free_initmem(void) 477void free_initmem(void)
478{ 478{
479 free_initmem_default(0); 479 free_initmem_default(-1);
480} 480}
481 481
482#ifdef CONFIG_BLK_DEV_INITRD 482#ifdef CONFIG_BLK_DEV_INITRD
@@ -486,7 +486,7 @@ static int keep_initrd;
486void free_initrd_mem(unsigned long start, unsigned long end) 486void free_initrd_mem(unsigned long start, unsigned long end)
487{ 487{
488 if (!keep_initrd) 488 if (!keep_initrd)
489 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 489 free_reserved_area((void *)start, (void *)end, -1, "initrd");
490} 490}
491 491
492static int __init keepinitrd_setup(char *__unused) 492static int __init keepinitrd_setup(char *__unused)
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index 4d658efc3289..026d29bee30b 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -214,11 +214,11 @@ extern int initrd_is_mapped;
214void free_initrd_mem(unsigned long start, unsigned long end) 214void free_initrd_mem(unsigned long start, unsigned long end)
215{ 215{
216 if (initrd_is_mapped) 216 if (initrd_is_mapped)
217 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 217 free_reserved_area((void *)start, (void *)end, -1, "initrd");
218} 218}
219#endif 219#endif
220 220
221void free_initmem(void) 221void free_initmem(void)
222{ 222{
223 free_initmem_default(0); 223 free_initmem_default(-1);
224} 224}
diff --git a/include/linux/mm.h b/include/linux/mm.h
index be1b96ce0650..083cc0ba2384 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1308,7 +1308,7 @@ extern void free_initmem(void);
1308/* 1308/*
1309 * Free reserved pages within range [PAGE_ALIGN(start), end & PAGE_MASK) 1309 * Free reserved pages within range [PAGE_ALIGN(start), end & PAGE_MASK)
1310 * into the buddy system. The freed pages will be poisoned with pattern 1310 * into the buddy system. The freed pages will be poisoned with pattern
1311 * "poison" if it's non-zero. 1311 * "poison" if it's within range [0, UCHAR_MAX].
1312 * Return pages freed into the buddy system. 1312 * Return pages freed into the buddy system.
1313 */ 1313 */
1314extern unsigned long free_reserved_area(void *start, void *end, 1314extern unsigned long free_reserved_area(void *start, void *end,
@@ -1348,8 +1348,9 @@ static inline void mark_page_reserved(struct page *page)
1348 1348
1349/* 1349/*
1350 * Default method to free all the __init memory into the buddy system. 1350 * Default method to free all the __init memory into the buddy system.
1351 * The freed pages will be poisoned with pattern "poison" if it is 1351 * The freed pages will be poisoned with pattern "poison" if it's within
1352 * non-zero. Return pages freed into the buddy system. 1352 * range [0, UCHAR_MAX].
1353 * Return pages freed into the buddy system.
1353 */ 1354 */
1354static inline unsigned long free_initmem_default(int poison) 1355static inline unsigned long free_initmem_default(int poison)
1355{ 1356{
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index be18ccd017bb..6780b2e18aa1 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5214,7 +5214,7 @@ unsigned long free_reserved_area(void *start, void *end, int poison, char *s)
5214 start = (void *)PAGE_ALIGN((unsigned long)start); 5214 start = (void *)PAGE_ALIGN((unsigned long)start);
5215 end = (void *)((unsigned long)end & PAGE_MASK); 5215 end = (void *)((unsigned long)end & PAGE_MASK);
5216 for (pos = start; pos < end; pos += PAGE_SIZE, pages++) { 5216 for (pos = start; pos < end; pos += PAGE_SIZE, pages++) {
5217 if (poison) 5217 if ((unsigned int)poison <= 0xFF)
5218 memset(pos, poison, PAGE_SIZE); 5218 memset(pos, poison, PAGE_SIZE);
5219 free_reserved_page(virt_to_page(pos)); 5219 free_reserved_page(virt_to_page(pos));
5220 } 5220 }