aboutsummaryrefslogtreecommitdiffstats
path: root/mm/bootmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/bootmem.c')
-rw-r--r--mm/bootmem.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c
index d7c791ef0036..58c66cc5056a 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -10,6 +10,7 @@
10 */ 10 */
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/pfn.h> 12#include <linux/pfn.h>
13#include <linux/slab.h>
13#include <linux/bootmem.h> 14#include <linux/bootmem.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/kmemleak.h> 16#include <linux/kmemleak.h>
@@ -180,19 +181,12 @@ static void __init __free_pages_memory(unsigned long start, unsigned long end)
180 end_aligned = end & ~(BITS_PER_LONG - 1); 181 end_aligned = end & ~(BITS_PER_LONG - 1);
181 182
182 if (end_aligned <= start_aligned) { 183 if (end_aligned <= start_aligned) {
183#if 1
184 printk(KERN_DEBUG " %lx - %lx\n", start, end);
185#endif
186 for (i = start; i < end; i++) 184 for (i = start; i < end; i++)
187 __free_pages_bootmem(pfn_to_page(i), 0); 185 __free_pages_bootmem(pfn_to_page(i), 0);
188 186
189 return; 187 return;
190 } 188 }
191 189
192#if 1
193 printk(KERN_DEBUG " %lx %lx - %lx %lx\n",
194 start, start_aligned, end_aligned, end);
195#endif
196 for (i = start; i < start_aligned; i++) 190 for (i = start; i < start_aligned; i++)
197 __free_pages_bootmem(pfn_to_page(i), 0); 191 __free_pages_bootmem(pfn_to_page(i), 0);
198 192
@@ -310,9 +304,22 @@ unsigned long __init free_all_bootmem_node(pg_data_t *pgdat)
310unsigned long __init free_all_bootmem(void) 304unsigned long __init free_all_bootmem(void)
311{ 305{
312#ifdef CONFIG_NO_BOOTMEM 306#ifdef CONFIG_NO_BOOTMEM
313 return free_all_memory_core_early(NODE_DATA(0)->node_id); 307 /*
308 * We need to use MAX_NUMNODES instead of NODE_DATA(0)->node_id
309 * because in some case like Node0 doesnt have RAM installed
310 * low ram will be on Node1
311 * Use MAX_NUMNODES will make sure all ranges in early_node_map[]
312 * will be used instead of only Node0 related
313 */
314 return free_all_memory_core_early(MAX_NUMNODES);
314#else 315#else
315 return free_all_bootmem_core(NODE_DATA(0)->bdata); 316 unsigned long total_pages = 0;
317 bootmem_data_t *bdata;
318
319 list_for_each_entry(bdata, &bdata_list, list)
320 total_pages += free_all_bootmem_core(bdata);
321
322 return total_pages;
316#endif 323#endif
317} 324}
318 325
@@ -428,9 +435,6 @@ void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
428{ 435{
429#ifdef CONFIG_NO_BOOTMEM 436#ifdef CONFIG_NO_BOOTMEM
430 free_early(physaddr, physaddr + size); 437 free_early(physaddr, physaddr + size);
431#if 0
432 printk(KERN_DEBUG "free %lx %lx\n", physaddr, size);
433#endif
434#else 438#else
435 unsigned long start, end; 439 unsigned long start, end;
436 440
@@ -456,9 +460,6 @@ void __init free_bootmem(unsigned long addr, unsigned long size)
456{ 460{
457#ifdef CONFIG_NO_BOOTMEM 461#ifdef CONFIG_NO_BOOTMEM
458 free_early(addr, addr + size); 462 free_early(addr, addr + size);
459#if 0
460 printk(KERN_DEBUG "free %lx %lx\n", addr, size);
461#endif
462#else 463#else
463 unsigned long start, end; 464 unsigned long start, end;
464 465