aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Walle <bwalle@suse.de>2008-02-07 03:15:17 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 11:42:25 -0500
commit72a7fe3967dbf86cb34e24fbf1d957fe24d2f246 (patch)
treec19f7d0b530577359840e959cce204939caf0649
parent25fad945a7f7ff2cf06e437381c6a1121784dbd9 (diff)
Introduce flags for reserve_bootmem()
This patchset adds a flags variable to reserve_bootmem() and uses the BOOTMEM_EXCLUSIVE flag in crashkernel reservation code to detect collisions between crashkernel area and already used memory. This patch: Change the reserve_bootmem() function to accept a new flag BOOTMEM_EXCLUSIVE. If that flag is set, the function returns with -EBUSY if the memory already has been reserved in the past. This is to avoid conflicts. Because that code runs before SMP initialisation, there's no race condition inside reserve_bootmem_core(). [akpm@linux-foundation.org: coding-style fixes] [akpm@linux-foundation.org: fix powerpc build] Signed-off-by: Bernhard Walle <bwalle@suse.de> Cc: <linux-arch@vger.kernel.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Vivek Goyal <vgoyal@in.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/alpha/kernel/core_irongate.c3
-rw-r--r--arch/alpha/kernel/setup.c5
-rw-r--r--arch/alpha/mm/numa.c5
-rw-r--r--arch/arm/mm/init.c4
-rw-r--r--arch/arm/mm/mmu.c17
-rw-r--r--arch/arm/mm/nommu.c9
-rw-r--r--arch/arm/plat-omap/fb.c2
-rw-r--r--arch/avr32/kernel/setup.c6
-rw-r--r--arch/blackfin/kernel/setup.c2
-rw-r--r--arch/cris/kernel/setup.c2
-rw-r--r--arch/frv/kernel/setup.c16
-rw-r--r--arch/h8300/kernel/setup.c2
-rw-r--r--arch/ia64/mm/contig.c2
-rw-r--r--arch/ia64/mm/discontig.c4
-rw-r--r--arch/m32r/kernel/setup.c11
-rw-r--r--arch/m32r/mm/discontig.c5
-rw-r--r--arch/m68k/atari/stram.c2
-rw-r--r--arch/m68k/kernel/setup.c3
-rw-r--r--arch/m68knommu/kernel/setup.c2
-rw-r--r--arch/mips/kernel/setup.c4
-rw-r--r--arch/mips/sgi-ip27/ip27-memory.c3
-rw-r--r--arch/parisc/mm/init.c14
-rw-r--r--arch/powerpc/mm/mem.c8
-rw-r--r--arch/powerpc/mm/numa.c2
-rw-r--r--arch/s390/kernel/setup.c11
-rw-r--r--arch/sh/kernel/setup.c10
-rw-r--r--arch/sh/mm/numa.c4
-rw-r--r--arch/sparc/mm/init.c6
-rw-r--r--arch/sparc64/mm/init.c8
-rw-r--r--arch/v850/kernel/anna.c3
-rw-r--r--arch/v850/kernel/as85ep1.c3
-rw-r--r--arch/v850/kernel/rte_ma1_cb.c6
-rw-r--r--arch/v850/kernel/setup.c12
-rw-r--r--arch/x86/kernel/mpparse_32.c6
-rw-r--r--arch/x86/kernel/setup_32.c18
-rw-r--r--arch/x86/kernel/setup_64.c5
-rw-r--r--arch/x86/mm/discontig_32.c3
-rw-r--r--arch/x86/mm/init_64.c4
-rw-r--r--arch/x86/mm/numa_64.c5
-rw-r--r--arch/x86/mm/srat_64.c3
-rw-r--r--include/asm-x86/mmzone_32.h4
-rw-r--r--include/linux/bootmem.h17
-rw-r--r--mm/bootmem.c27
43 files changed, 183 insertions, 105 deletions
diff --git a/arch/alpha/kernel/core_irongate.c b/arch/alpha/kernel/core_irongate.c
index e4a0bcf1d28b..a872078497be 100644
--- a/arch/alpha/kernel/core_irongate.c
+++ b/arch/alpha/kernel/core_irongate.c
@@ -241,7 +241,8 @@ albacore_init_arch(void)
241 size / 1024); 241 size / 1024);
242 } 242 }
243#endif 243#endif
244 reserve_bootmem_node(NODE_DATA(0), pci_mem, memtop - pci_mem); 244 reserve_bootmem_node(NODE_DATA(0), pci_mem, memtop -
245 pci_mem, BOOTMEM_DEFAULT);
245 printk("irongate_init_arch: temporarily reserving " 246 printk("irongate_init_arch: temporarily reserving "
246 "region %08lx-%08lx for PCI\n", pci_mem, memtop - 1); 247 "region %08lx-%08lx for PCI\n", pci_mem, memtop - 1);
247 } 248 }
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index beff6297f788..74c346625658 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -428,7 +428,8 @@ setup_memory(void *kernel_end)
428 } 428 }
429 429
430 /* Reserve the bootmap memory. */ 430 /* Reserve the bootmap memory. */
431 reserve_bootmem(PFN_PHYS(bootmap_start), bootmap_size); 431 reserve_bootmem(PFN_PHYS(bootmap_start), bootmap_size,
432 BOOTMEM_DEFAULT);
432 printk("reserving pages %ld:%ld\n", bootmap_start, bootmap_start+PFN_UP(bootmap_size)); 433 printk("reserving pages %ld:%ld\n", bootmap_start, bootmap_start+PFN_UP(bootmap_size));
433 434
434#ifdef CONFIG_BLK_DEV_INITRD 435#ifdef CONFIG_BLK_DEV_INITRD
@@ -446,7 +447,7 @@ setup_memory(void *kernel_end)
446 phys_to_virt(PFN_PHYS(max_low_pfn))); 447 phys_to_virt(PFN_PHYS(max_low_pfn)));
447 } else { 448 } else {
448 reserve_bootmem(virt_to_phys((void *)initrd_start), 449 reserve_bootmem(virt_to_phys((void *)initrd_start),
449 INITRD_SIZE); 450 INITRD_SIZE, BOOTMEM_DEFAULT);
450 } 451 }
451 } 452 }
452#endif /* CONFIG_BLK_DEV_INITRD */ 453#endif /* CONFIG_BLK_DEV_INITRD */
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
index e3e3806a6f25..10ab7833e83c 100644
--- a/arch/alpha/mm/numa.c
+++ b/arch/alpha/mm/numa.c
@@ -242,7 +242,8 @@ setup_memory_node(int nid, void *kernel_end)
242 } 242 }
243 243
244 /* Reserve the bootmap memory. */ 244 /* Reserve the bootmap memory. */
245 reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(bootmap_start), bootmap_size); 245 reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(bootmap_start),
246 bootmap_size, BOOTMEM_DEFAULT);
246 printk(" reserving pages %ld:%ld\n", bootmap_start, bootmap_start+PFN_UP(bootmap_size)); 247 printk(" reserving pages %ld:%ld\n", bootmap_start, bootmap_start+PFN_UP(bootmap_size));
247 248
248 node_set_online(nid); 249 node_set_online(nid);
@@ -281,7 +282,7 @@ setup_memory(void *kernel_end)
281 nid = kvaddr_to_nid(initrd_start); 282 nid = kvaddr_to_nid(initrd_start);
282 reserve_bootmem_node(NODE_DATA(nid), 283 reserve_bootmem_node(NODE_DATA(nid),
283 virt_to_phys((void *)initrd_start), 284 virt_to_phys((void *)initrd_start),
284 INITRD_SIZE); 285 INITRD_SIZE, BOOTMEM_DEFAULT);
285 } 286 }
286 } 287 }
287#endif /* CONFIG_BLK_DEV_INITRD */ 288#endif /* CONFIG_BLK_DEV_INITRD */
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index c0ad7c0fbae0..ec00f26bffa4 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -239,7 +239,7 @@ bootmem_init_node(int node, int initrd_node, struct meminfo *mi)
239 * Reserve the bootmem bitmap for this node. 239 * Reserve the bootmem bitmap for this node.
240 */ 240 */
241 reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT, 241 reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT,
242 boot_pages << PAGE_SHIFT); 242 boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
243 243
244#ifdef CONFIG_BLK_DEV_INITRD 244#ifdef CONFIG_BLK_DEV_INITRD
245 /* 245 /*
@@ -247,7 +247,7 @@ bootmem_init_node(int node, int initrd_node, struct meminfo *mi)
247 */ 247 */
248 if (node == initrd_node) { 248 if (node == initrd_node) {
249 reserve_bootmem_node(pgdat, phys_initrd_start, 249 reserve_bootmem_node(pgdat, phys_initrd_start,
250 phys_initrd_size); 250 phys_initrd_size, BOOTMEM_DEFAULT);
251 initrd_start = __phys_to_virt(phys_initrd_start); 251 initrd_start = __phys_to_virt(phys_initrd_start);
252 initrd_end = initrd_start + phys_initrd_size; 252 initrd_end = initrd_start + phys_initrd_size;
253 } 253 }
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index e5d61ee3d4a1..d41a75ed3dce 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -605,9 +605,11 @@ void __init reserve_node_zero(pg_data_t *pgdat)
605 * Note that this can only be in node 0. 605 * Note that this can only be in node 0.
606 */ 606 */
607#ifdef CONFIG_XIP_KERNEL 607#ifdef CONFIG_XIP_KERNEL
608 reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start); 608 reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start,
609 BOOTMEM_DEFAULT);
609#else 610#else
610 reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext); 611 reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext,
612 BOOTMEM_DEFAULT);
611#endif 613#endif
612 614
613 /* 615 /*
@@ -615,7 +617,7 @@ void __init reserve_node_zero(pg_data_t *pgdat)
615 * and can only be in node 0. 617 * and can only be in node 0.
616 */ 618 */
617 reserve_bootmem_node(pgdat, __pa(swapper_pg_dir), 619 reserve_bootmem_node(pgdat, __pa(swapper_pg_dir),
618 PTRS_PER_PGD * sizeof(pgd_t)); 620 PTRS_PER_PGD * sizeof(pgd_t), BOOTMEM_DEFAULT);
619 621
620 /* 622 /*
621 * Hmm... This should go elsewhere, but we really really need to 623 * Hmm... This should go elsewhere, but we really really need to
@@ -638,8 +640,10 @@ void __init reserve_node_zero(pg_data_t *pgdat)
638 /* H1940 and RX3715 need to reserve this for suspend */ 640 /* H1940 and RX3715 need to reserve this for suspend */
639 641
640 if (machine_is_h1940() || machine_is_rx3715()) { 642 if (machine_is_h1940() || machine_is_rx3715()) {
641 reserve_bootmem_node(pgdat, 0x30003000, 0x1000); 643 reserve_bootmem_node(pgdat, 0x30003000, 0x1000,
642 reserve_bootmem_node(pgdat, 0x30081000, 0x1000); 644 BOOTMEM_DEFAULT);
645 reserve_bootmem_node(pgdat, 0x30081000, 0x1000,
646 BOOTMEM_DEFAULT);
643 } 647 }
644 648
645#ifdef CONFIG_SA1111 649#ifdef CONFIG_SA1111
@@ -650,7 +654,8 @@ void __init reserve_node_zero(pg_data_t *pgdat)
650 res_size = __pa(swapper_pg_dir) - PHYS_OFFSET; 654 res_size = __pa(swapper_pg_dir) - PHYS_OFFSET;
651#endif 655#endif
652 if (res_size) 656 if (res_size)
653 reserve_bootmem_node(pgdat, PHYS_OFFSET, res_size); 657 reserve_bootmem_node(pgdat, PHYS_OFFSET, res_size,
658 BOOTMEM_DEFAULT);
654} 659}
655 660
656/* 661/*
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 8cd3a60954f0..63c62fdea521 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -27,9 +27,11 @@ void __init reserve_node_zero(pg_data_t *pgdat)
27 * Note that this can only be in node 0. 27 * Note that this can only be in node 0.
28 */ 28 */
29#ifdef CONFIG_XIP_KERNEL 29#ifdef CONFIG_XIP_KERNEL
30 reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start); 30 reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start,
31 BOOTMEM_DEFAULT);
31#else 32#else
32 reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext); 33 reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext,
34 BOOTMEM_DEFAULT);
33#endif 35#endif
34 36
35 /* 37 /*
@@ -37,7 +39,8 @@ void __init reserve_node_zero(pg_data_t *pgdat)
37 * some architectures which the DRAM is the exception vector to trap, 39 * some architectures which the DRAM is the exception vector to trap,
38 * alloc_page breaks with error, although it is not NULL, but "0." 40 * alloc_page breaks with error, although it is not NULL, but "0."
39 */ 41 */
40 reserve_bootmem_node(pgdat, CONFIG_VECTORS_BASE, PAGE_SIZE); 42 reserve_bootmem_node(pgdat, CONFIG_VECTORS_BASE, PAGE_SIZE,
43 BOOTMEM_DEFAULT);
41} 44}
42 45
43/* 46/*
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c
index ee40c1a0b83d..7854f19b77cf 100644
--- a/arch/arm/plat-omap/fb.c
+++ b/arch/arm/plat-omap/fb.c
@@ -207,7 +207,7 @@ void __init omapfb_reserve_sdram(void)
207 return; 207 return;
208 } 208 }
209 if (rg.paddr) 209 if (rg.paddr)
210 reserve_bootmem(rg.paddr, rg.size); 210 reserve_bootmem(rg.paddr, rg.size, BOOTMEM_DEFAULT);
211 reserved += rg.size; 211 reserved += rg.size;
212 omapfb_config.mem_desc.region[i] = rg; 212 omapfb_config.mem_desc.region[i] = rg;
213 configured_regions++; 213 configured_regions++;
diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c
index 4b4c1884e1c5..e66a07a928cd 100644
--- a/arch/avr32/kernel/setup.c
+++ b/arch/avr32/kernel/setup.c
@@ -489,7 +489,8 @@ static void __init setup_bootmem(void)
489 /* Reserve space for the bootmem bitmap... */ 489 /* Reserve space for the bootmem bitmap... */
490 reserve_bootmem_node(NODE_DATA(node), 490 reserve_bootmem_node(NODE_DATA(node),
491 PFN_PHYS(bootmap_pfn), 491 PFN_PHYS(bootmap_pfn),
492 bootmap_size); 492 bootmap_size,
493 BOOTMEM_DEFAULT);
493 494
494 /* ...and any other reserved regions. */ 495 /* ...and any other reserved regions. */
495 for (res = reserved; res; res = res->sibling) { 496 for (res = reserved; res; res = res->sibling) {
@@ -505,7 +506,8 @@ static void __init setup_bootmem(void)
505 && res->end < PFN_PHYS(max_pfn)) 506 && res->end < PFN_PHYS(max_pfn))
506 reserve_bootmem_node( 507 reserve_bootmem_node(
507 NODE_DATA(node), res->start, 508 NODE_DATA(node), res->start,
508 res->end - res->start + 1); 509 res->end - res->start + 1,
510 BOOTMEM_DEFAULT);
509 } 511 }
510 512
511 node_set_online(node); 513 node_set_online(node);
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 462cae893757..6e106b3d7729 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -406,7 +406,7 @@ void __init setup_arch(char **cmdline_p)
406 */ 406 */
407 free_bootmem(memory_start, memory_end - memory_start); 407 free_bootmem(memory_start, memory_end - memory_start);
408 408
409 reserve_bootmem(memory_start, bootmap_size); 409 reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
410 /* 410 /*
411 * get kmalloc into gear 411 * get kmalloc into gear
412 */ 412 */
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index 65466c49d7a9..4da042e100a0 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -137,7 +137,7 @@ setup_arch(char **cmdline_p)
137 * Arguments are start, size 137 * Arguments are start, size
138 */ 138 */
139 139
140 reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size); 140 reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT);
141 141
142 /* paging_init() sets up the MMU and marks all pages as reserved */ 142 /* paging_init() sets up the MMU and marks all pages as reserved */
143 143
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index b38ae1fc15fd..6c01464db699 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -925,13 +925,15 @@ static void __init setup_linux_memory(void)
925#endif 925#endif
926 926
927 /* take back the memory occupied by the kernel image and the bootmem alloc map */ 927 /* take back the memory occupied by the kernel image and the bootmem alloc map */
928 reserve_bootmem(kstart, kend - kstart + bootmap_size); 928 reserve_bootmem(kstart, kend - kstart + bootmap_size,
929 BOOTMEM_DEFAULT);
929 930
930 /* reserve the memory occupied by the initial ramdisk */ 931 /* reserve the memory occupied by the initial ramdisk */
931#ifdef CONFIG_BLK_DEV_INITRD 932#ifdef CONFIG_BLK_DEV_INITRD
932 if (LOADER_TYPE && INITRD_START) { 933 if (LOADER_TYPE && INITRD_START) {
933 if (INITRD_START + INITRD_SIZE <= (low_top_pfn << PAGE_SHIFT)) { 934 if (INITRD_START + INITRD_SIZE <= (low_top_pfn << PAGE_SHIFT)) {
934 reserve_bootmem(INITRD_START, INITRD_SIZE); 935 reserve_bootmem(INITRD_START, INITRD_SIZE,
936 BOOTMEM_DEFAULT);
935 initrd_start = INITRD_START + PAGE_OFFSET; 937 initrd_start = INITRD_START + PAGE_OFFSET;
936 initrd_end = initrd_start + INITRD_SIZE; 938 initrd_end = initrd_start + INITRD_SIZE;
937 } 939 }
@@ -986,9 +988,10 @@ static void __init setup_uclinux_memory(void)
986 988
987 /* now take back the bits the core kernel is occupying */ 989 /* now take back the bits the core kernel is occupying */
988#ifndef CONFIG_PROTECT_KERNEL 990#ifndef CONFIG_PROTECT_KERNEL
989 reserve_bootmem(kend, bootmap_size); 991 reserve_bootmem(kend, bootmap_size, BOOTMEM_DEFAULT);
990 reserve_bootmem((unsigned long) &__kernel_image_start, 992 reserve_bootmem((unsigned long) &__kernel_image_start,
991 kend - (unsigned long) &__kernel_image_start); 993 kend - (unsigned long) &__kernel_image_start,
994 BOOTMEM_DEFAULT);
992 995
993#else 996#else
994 dampr = __get_DAMPR(0); 997 dampr = __get_DAMPR(0);
@@ -996,14 +999,15 @@ static void __init setup_uclinux_memory(void)
996 dampr = (dampr >> 4) + 17; 999 dampr = (dampr >> 4) + 17;
997 dampr = 1 << dampr; 1000 dampr = 1 << dampr;
998 1001
999 reserve_bootmem(__get_DAMPR(0) & xAMPRx_PPFN, dampr); 1002 reserve_bootmem(__get_DAMPR(0) & xAMPRx_PPFN, dampr, BOOTMEM_DEFAULT);
1000#endif 1003#endif
1001 1004
1002 /* reserve some memory to do uncached DMA through if requested */ 1005 /* reserve some memory to do uncached DMA through if requested */
1003#ifdef CONFIG_RESERVE_DMA_COHERENT 1006#ifdef CONFIG_RESERVE_DMA_COHERENT
1004 if (dma_coherent_mem_start) 1007 if (dma_coherent_mem_start)
1005 reserve_bootmem(dma_coherent_mem_start, 1008 reserve_bootmem(dma_coherent_mem_start,
1006 dma_coherent_mem_end - dma_coherent_mem_start); 1009 dma_coherent_mem_end - dma_coherent_mem_start,
1010 BOOTMEM_DEFAULT);
1007#endif 1011#endif
1008 1012
1009} /* end setup_uclinux_memory() */ 1013} /* end setup_uclinux_memory() */
diff --git a/arch/h8300/kernel/setup.c b/arch/h8300/kernel/setup.c
index b2e86d0255e6..cd3734614d9d 100644
--- a/arch/h8300/kernel/setup.c
+++ b/arch/h8300/kernel/setup.c
@@ -173,7 +173,7 @@ void __init setup_arch(char **cmdline_p)
173 * the bootmem bitmap so we then reserve it after freeing it :-) 173 * the bootmem bitmap so we then reserve it after freeing it :-)
174 */ 174 */
175 free_bootmem(memory_start, memory_end - memory_start); 175 free_bootmem(memory_start, memory_end - memory_start);
176 reserve_bootmem(memory_start, bootmap_size); 176 reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
177 /* 177 /*
178 * get kmalloc into gear 178 * get kmalloc into gear
179 */ 179 */
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 7e9c275ea148..344f64eca7a9 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -218,7 +218,7 @@ find_memory (void)
218 218
219 /* Free all available memory, then mark bootmem-map as being in use. */ 219 /* Free all available memory, then mark bootmem-map as being in use. */
220 efi_memmap_walk(filter_rsvd_memory, free_bootmem); 220 efi_memmap_walk(filter_rsvd_memory, free_bootmem);
221 reserve_bootmem(bootmap_start, bootmap_size); 221 reserve_bootmem(bootmap_start, bootmap_size, BOOTMEM_DEFAULT);
222 222
223 find_initrd(); 223 find_initrd();
224 224
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 0b567398f38e..ee5e68b2af94 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -299,12 +299,12 @@ static void __init reserve_pernode_space(void)
299 pages = bdp->node_low_pfn - (bdp->node_boot_start>>PAGE_SHIFT); 299 pages = bdp->node_low_pfn - (bdp->node_boot_start>>PAGE_SHIFT);
300 size = bootmem_bootmap_pages(pages) << PAGE_SHIFT; 300 size = bootmem_bootmap_pages(pages) << PAGE_SHIFT;
301 base = __pa(bdp->node_bootmem_map); 301 base = __pa(bdp->node_bootmem_map);
302 reserve_bootmem_node(pdp, base, size); 302 reserve_bootmem_node(pdp, base, size, BOOTMEM_DEFAULT);
303 303
304 /* Now the per-node space */ 304 /* Now the per-node space */
305 size = mem_data[node].pernode_size; 305 size = mem_data[node].pernode_size;
306 base = __pa(mem_data[node].pernode_addr); 306 base = __pa(mem_data[node].pernode_addr);
307 reserve_bootmem_node(pdp, base, size); 307 reserve_bootmem_node(pdp, base, size, BOOTMEM_DEFAULT);
308 } 308 }
309} 309}
310 310
diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c
index d64814385d70..f1f5db0c4084 100644
--- a/arch/m32r/kernel/setup.c
+++ b/arch/m32r/kernel/setup.c
@@ -177,25 +177,28 @@ static unsigned long __init setup_memory(void)
177 */ 177 */
178 reserve_bootmem(CONFIG_MEMORY_START + PAGE_SIZE, 178 reserve_bootmem(CONFIG_MEMORY_START + PAGE_SIZE,
179 (PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE - 1) 179 (PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE - 1)
180 - CONFIG_MEMORY_START); 180 - CONFIG_MEMORY_START,
181 BOOTMEM_DEFAULT);
181 182
182 /* 183 /*
183 * reserve physical page 0 - it's a special BIOS page on many boxes, 184 * reserve physical page 0 - it's a special BIOS page on many boxes,
184 * enabling clean reboots, SMP operation, laptop functions. 185 * enabling clean reboots, SMP operation, laptop functions.
185 */ 186 */
186 reserve_bootmem(CONFIG_MEMORY_START, PAGE_SIZE); 187 reserve_bootmem(CONFIG_MEMORY_START, PAGE_SIZE, BOOTMEM_DEFAULT);
187 188
188 /* 189 /*
189 * reserve memory hole 190 * reserve memory hole
190 */ 191 */
191#ifdef CONFIG_MEMHOLE 192#ifdef CONFIG_MEMHOLE
192 reserve_bootmem(CONFIG_MEMHOLE_START, CONFIG_MEMHOLE_SIZE); 193 reserve_bootmem(CONFIG_MEMHOLE_START, CONFIG_MEMHOLE_SIZE,
194 BOOTMEM_DEFAULT);
193#endif 195#endif
194 196
195#ifdef CONFIG_BLK_DEV_INITRD 197#ifdef CONFIG_BLK_DEV_INITRD
196 if (LOADER_TYPE && INITRD_START) { 198 if (LOADER_TYPE && INITRD_START) {
197 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { 199 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {
198 reserve_bootmem(INITRD_START, INITRD_SIZE); 200 reserve_bootmem(INITRD_START, INITRD_SIZE,
201 BOOTMEM_DEFAULT);
199 initrd_start = INITRD_START + PAGE_OFFSET; 202 initrd_start = INITRD_START + PAGE_OFFSET;
200 initrd_end = initrd_start + INITRD_SIZE; 203 initrd_end = initrd_start + INITRD_SIZE;
201 printk("initrd:start[%08lx],size[%08lx]\n", 204 printk("initrd:start[%08lx],size[%08lx]\n",
diff --git a/arch/m32r/mm/discontig.c b/arch/m32r/mm/discontig.c
index c7efdb0aefc5..07c1af7dc0e2 100644
--- a/arch/m32r/mm/discontig.c
+++ b/arch/m32r/mm/discontig.c
@@ -91,7 +91,8 @@ unsigned long __init setup_memory(void)
91 PFN_PHYS(mp->pages)); 91 PFN_PHYS(mp->pages));
92 92
93 reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(mp->start_pfn), 93 reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(mp->start_pfn),
94 PFN_PHYS(mp->free_pfn - mp->start_pfn) + bootmap_size); 94 PFN_PHYS(mp->free_pfn - mp->start_pfn) + bootmap_size,
95 BOOTMEM_DEFAULT);
95 96
96 if (max_low_pfn < max_pfn) 97 if (max_low_pfn < max_pfn)
97 max_low_pfn = max_pfn; 98 max_low_pfn = max_pfn;
@@ -104,7 +105,7 @@ unsigned long __init setup_memory(void)
104 if (LOADER_TYPE && INITRD_START) { 105 if (LOADER_TYPE && INITRD_START) {
105 if (INITRD_START + INITRD_SIZE <= PFN_PHYS(max_low_pfn)) { 106 if (INITRD_START + INITRD_SIZE <= PFN_PHYS(max_low_pfn)) {
106 reserve_bootmem_node(NODE_DATA(0), INITRD_START, 107 reserve_bootmem_node(NODE_DATA(0), INITRD_START,
107 INITRD_SIZE); 108 INITRD_SIZE, BOOTMEM_DEFAULT);
108 initrd_start = INITRD_START + PAGE_OFFSET; 109 initrd_start = INITRD_START + PAGE_OFFSET;
109 initrd_end = initrd_start + INITRD_SIZE; 110 initrd_end = initrd_start + INITRD_SIZE;
110 printk("initrd:start[%08lx],size[%08lx]\n", 111 printk("initrd:start[%08lx],size[%08lx]\n",
diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c
index 8dda6515887a..0055a6c06f75 100644
--- a/arch/m68k/atari/stram.c
+++ b/arch/m68k/atari/stram.c
@@ -154,7 +154,7 @@ void __init atari_stram_reserve_pages(void *start_mem)
154 /* always reserve first page of ST-RAM, the first 2 kB are 154 /* always reserve first page of ST-RAM, the first 2 kB are
155 * supervisor-only! */ 155 * supervisor-only! */
156 if (!kernel_in_stram) 156 if (!kernel_in_stram)
157 reserve_bootmem (0, PAGE_SIZE); 157 reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT);
158 158
159} 159}
160 160
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index ed3a4caec620..9a06c48edcb3 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -323,7 +323,8 @@ void __init setup_arch(char **cmdline_p)
323#ifdef CONFIG_BLK_DEV_INITRD 323#ifdef CONFIG_BLK_DEV_INITRD
324 if (m68k_ramdisk.size) { 324 if (m68k_ramdisk.size) {
325 reserve_bootmem_node(__virt_to_node(phys_to_virt(m68k_ramdisk.addr)), 325 reserve_bootmem_node(__virt_to_node(phys_to_virt(m68k_ramdisk.addr)),
326 m68k_ramdisk.addr, m68k_ramdisk.size); 326 m68k_ramdisk.addr, m68k_ramdisk.size,
327 BOOTMEM_DEFAULT);
327 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr); 328 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
328 initrd_end = initrd_start + m68k_ramdisk.size; 329 initrd_end = initrd_start + m68k_ramdisk.size;
329 printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end); 330 printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
diff --git a/arch/m68knommu/kernel/setup.c b/arch/m68knommu/kernel/setup.c
index 81507c53d4a9..156c6c662c7e 100644
--- a/arch/m68knommu/kernel/setup.c
+++ b/arch/m68knommu/kernel/setup.c
@@ -203,7 +203,7 @@ void __init setup_arch(char **cmdline_p)
203 * the bootmem bitmap so we then reserve it after freeing it :-) 203 * the bootmem bitmap so we then reserve it after freeing it :-)
204 */ 204 */
205 free_bootmem(memory_start, memory_end - memory_start); 205 free_bootmem(memory_start, memory_end - memory_start);
206 reserve_bootmem(memory_start, bootmap_size); 206 reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
207 207
208 /* 208 /*
209 * Get kmalloc into gear. 209 * Get kmalloc into gear.
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index c032409cba9b..39f3dfe134fb 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -232,7 +232,7 @@ static void __init finalize_initrd(void)
232 goto disable; 232 goto disable;
233 } 233 }
234 234
235 reserve_bootmem(__pa(initrd_start), size); 235 reserve_bootmem(__pa(initrd_start), size, BOOTMEM_DEFAULT);
236 initrd_below_start_ok = 1; 236 initrd_below_start_ok = 1;
237 237
238 printk(KERN_INFO "Initial ramdisk at: 0x%lx (%lu bytes)\n", 238 printk(KERN_INFO "Initial ramdisk at: 0x%lx (%lu bytes)\n",
@@ -413,7 +413,7 @@ static void __init bootmem_init(void)
413 /* 413 /*
414 * Reserve the bootmap memory. 414 * Reserve the bootmap memory.
415 */ 415 */
416 reserve_bootmem(PFN_PHYS(mapstart), bootmap_size); 416 reserve_bootmem(PFN_PHYS(mapstart), bootmap_size, BOOTMEM_DEFAULT);
417 417
418 /* 418 /*
419 * Reserve initrd memory if needed. 419 * Reserve initrd memory if needed.
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index e5e023f50a07..bf438d02366e 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -465,7 +465,8 @@ static void __init node_mem_init(cnodeid_t node)
465 free_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT, 465 free_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT,
466 (slot_lastpfn - slot_firstpfn) << PAGE_SHIFT); 466 (slot_lastpfn - slot_firstpfn) << PAGE_SHIFT);
467 reserve_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT, 467 reserve_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT,
468 ((slot_freepfn - slot_firstpfn) << PAGE_SHIFT) + bootmap_size); 468 ((slot_freepfn - slot_firstpfn) << PAGE_SHIFT) + bootmap_size,
469 BOOTMEM_DEFAULT);
469} 470}
470 471
471/* 472/*
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index aa875fa43488..eb80f5e33d7d 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -315,11 +315,13 @@ static void __init setup_bootmem(void)
315#define PDC_CONSOLE_IO_IODC_SIZE 32768 315#define PDC_CONSOLE_IO_IODC_SIZE 32768
316 316
317 reserve_bootmem_node(NODE_DATA(0), 0UL, 317 reserve_bootmem_node(NODE_DATA(0), 0UL,
318 (unsigned long)(PAGE0->mem_free + PDC_CONSOLE_IO_IODC_SIZE)); 318 (unsigned long)(PAGE0->mem_free +
319 PDC_CONSOLE_IO_IODC_SIZE), BOOTMEM_DEFAULT);
319 reserve_bootmem_node(NODE_DATA(0), __pa((unsigned long)_text), 320 reserve_bootmem_node(NODE_DATA(0), __pa((unsigned long)_text),
320 (unsigned long)(_end - _text)); 321 (unsigned long)(_end - _text), BOOTMEM_DEFAULT);
321 reserve_bootmem_node(NODE_DATA(0), (bootmap_start_pfn << PAGE_SHIFT), 322 reserve_bootmem_node(NODE_DATA(0), (bootmap_start_pfn << PAGE_SHIFT),
322 ((bootmap_pfn - bootmap_start_pfn) << PAGE_SHIFT)); 323 ((bootmap_pfn - bootmap_start_pfn) << PAGE_SHIFT),
324 BOOTMEM_DEFAULT);
323 325
324#ifndef CONFIG_DISCONTIGMEM 326#ifndef CONFIG_DISCONTIGMEM
325 327
@@ -328,7 +330,8 @@ static void __init setup_bootmem(void)
328 for (i = 0; i < npmem_holes; i++) { 330 for (i = 0; i < npmem_holes; i++) {
329 reserve_bootmem_node(NODE_DATA(0), 331 reserve_bootmem_node(NODE_DATA(0),
330 (pmem_holes[i].start_pfn << PAGE_SHIFT), 332 (pmem_holes[i].start_pfn << PAGE_SHIFT),
331 (pmem_holes[i].pages << PAGE_SHIFT)); 333 (pmem_holes[i].pages << PAGE_SHIFT),
334 BOOTMEM_DEFAULT);
332 } 335 }
333#endif 336#endif
334 337
@@ -346,7 +349,8 @@ static void __init setup_bootmem(void)
346 initrd_below_start_ok = 1; 349 initrd_below_start_ok = 1;
347 printk(KERN_INFO "initrd: reserving %08lx-%08lx (mem_max %08lx)\n", __pa(initrd_start), __pa(initrd_start) + initrd_reserve, mem_max); 350 printk(KERN_INFO "initrd: reserving %08lx-%08lx (mem_max %08lx)\n", __pa(initrd_start), __pa(initrd_start) + initrd_reserve, mem_max);
348 351
349 reserve_bootmem_node(NODE_DATA(0),__pa(initrd_start), initrd_reserve); 352 reserve_bootmem_node(NODE_DATA(0), __pa(initrd_start),
353 initrd_reserve, BOOTMEM_DEFAULT);
350 } 354 }
351 } 355 }
352#endif 356#endif
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index e8122447f019..ff5debf5eedd 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -220,12 +220,13 @@ void __init do_init_bootmem(void)
220 lmb_size_bytes(&lmb.reserved, i) - 1; 220 lmb_size_bytes(&lmb.reserved, i) - 1;
221 if (addr < total_lowmem) 221 if (addr < total_lowmem)
222 reserve_bootmem(lmb.reserved.region[i].base, 222 reserve_bootmem(lmb.reserved.region[i].base,
223 lmb_size_bytes(&lmb.reserved, i)); 223 lmb_size_bytes(&lmb.reserved, i),
224 BOOTMEM_DEFAULT);
224 else if (lmb.reserved.region[i].base < total_lowmem) { 225 else if (lmb.reserved.region[i].base < total_lowmem) {
225 unsigned long adjusted_size = total_lowmem - 226 unsigned long adjusted_size = total_lowmem -
226 lmb.reserved.region[i].base; 227 lmb.reserved.region[i].base;
227 reserve_bootmem(lmb.reserved.region[i].base, 228 reserve_bootmem(lmb.reserved.region[i].base,
228 adjusted_size); 229 adjusted_size, BOOTMEM_DEFAULT);
229 } 230 }
230 } 231 }
231#else 232#else
@@ -234,7 +235,8 @@ void __init do_init_bootmem(void)
234 /* reserve the sections we're already using */ 235 /* reserve the sections we're already using */
235 for (i = 0; i < lmb.reserved.cnt; i++) 236 for (i = 0; i < lmb.reserved.cnt; i++)
236 reserve_bootmem(lmb.reserved.region[i].base, 237 reserve_bootmem(lmb.reserved.region[i].base,
237 lmb_size_bytes(&lmb.reserved, i)); 238 lmb_size_bytes(&lmb.reserved, i),
239 BOOTMEM_DEFAULT);
238 240
239#endif 241#endif
240 /* XXX need to clip this if using highmem? */ 242 /* XXX need to clip this if using highmem? */
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index c12adc3ddffd..bc60322d2436 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -675,7 +675,7 @@ void __init do_init_bootmem(void)
675 dbg("reserve_bootmem %lx %lx\n", physbase, 675 dbg("reserve_bootmem %lx %lx\n", physbase,
676 size); 676 size);
677 reserve_bootmem_node(NODE_DATA(nid), physbase, 677 reserve_bootmem_node(NODE_DATA(nid), physbase,
678 size); 678 size, BOOTMEM_DEFAULT);
679 } 679 }
680 } 680 }
681 681
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 29ae165d1749..f9f8779022a0 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -649,21 +649,24 @@ setup_memory(void)
649 /* 649 /*
650 * Reserve memory used for lowcore/command line/kernel image. 650 * Reserve memory used for lowcore/command line/kernel image.
651 */ 651 */
652 reserve_bootmem(0, (unsigned long)_ehead); 652 reserve_bootmem(0, (unsigned long)_ehead, BOOTMEM_DEFAULT);
653 reserve_bootmem((unsigned long)_stext, 653 reserve_bootmem((unsigned long)_stext,
654 PFN_PHYS(start_pfn) - (unsigned long)_stext); 654 PFN_PHYS(start_pfn) - (unsigned long)_stext,
655 BOOTMEM_DEFAULT);
655 /* 656 /*
656 * Reserve the bootmem bitmap itself as well. We do this in two 657 * Reserve the bootmem bitmap itself as well. We do this in two
657 * steps (first step was init_bootmem()) because this catches 658 * steps (first step was init_bootmem()) because this catches
658 * the (very unlikely) case of us accidentally initializing the 659 * the (very unlikely) case of us accidentally initializing the
659 * bootmem allocator with an invalid RAM area. 660 * bootmem allocator with an invalid RAM area.
660 */ 661 */
661 reserve_bootmem(start_pfn << PAGE_SHIFT, bootmap_size); 662 reserve_bootmem(start_pfn << PAGE_SHIFT, bootmap_size,
663 BOOTMEM_DEFAULT);
662 664
663#ifdef CONFIG_BLK_DEV_INITRD 665#ifdef CONFIG_BLK_DEV_INITRD
664 if (INITRD_START && INITRD_SIZE) { 666 if (INITRD_START && INITRD_SIZE) {
665 if (INITRD_START + INITRD_SIZE <= memory_end) { 667 if (INITRD_START + INITRD_SIZE <= memory_end) {
666 reserve_bootmem(INITRD_START, INITRD_SIZE); 668 reserve_bootmem(INITRD_START, INITRD_SIZE,
669 BOOTMEM_DEFAULT);
667 initrd_start = INITRD_START; 670 initrd_start = INITRD_START;
668 initrd_end = initrd_start + INITRD_SIZE; 671 initrd_end = initrd_start + INITRD_SIZE;
669 } else { 672 } else {
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 855cdf9d85b1..af10db90a554 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -148,7 +148,8 @@ static void __init reserve_crashkernel(void)
148 (unsigned long)(free_mem >> 20)); 148 (unsigned long)(free_mem >> 20));
149 crashk_res.start = crash_base; 149 crashk_res.start = crash_base;
150 crashk_res.end = crash_base + crash_size - 1; 150 crashk_res.end = crash_base + crash_size - 1;
151 reserve_bootmem(crash_base, crash_size); 151 reserve_bootmem(crash_base, crash_size,
152 BOOTMEM_DEFAULT);
152 } else 153 } else
153 printk(KERN_INFO "crashkernel reservation failed - " 154 printk(KERN_INFO "crashkernel reservation failed - "
154 "you have to specify a base address\n"); 155 "you have to specify a base address\n");
@@ -184,13 +185,14 @@ void __init setup_bootmem_allocator(unsigned long free_pfn)
184 * an invalid RAM area. 185 * an invalid RAM area.
185 */ 186 */
186 reserve_bootmem(__MEMORY_START+PAGE_SIZE, 187 reserve_bootmem(__MEMORY_START+PAGE_SIZE,
187 (PFN_PHYS(free_pfn)+bootmap_size+PAGE_SIZE-1)-__MEMORY_START); 188 (PFN_PHYS(free_pfn)+bootmap_size+PAGE_SIZE-1)-__MEMORY_START,
189 BOOTMEM_DEFAULT);
188 190
189 /* 191 /*
190 * reserve physical page 0 - it's a special BIOS page on many boxes, 192 * reserve physical page 0 - it's a special BIOS page on many boxes,
191 * enabling clean reboots, SMP operation, laptop functions. 193 * enabling clean reboots, SMP operation, laptop functions.
192 */ 194 */
193 reserve_bootmem(__MEMORY_START, PAGE_SIZE); 195 reserve_bootmem(__MEMORY_START, PAGE_SIZE, BOOTMEM_DEFAULT);
194 196
195 sparse_memory_present_with_active_regions(0); 197 sparse_memory_present_with_active_regions(0);
196 198
@@ -200,7 +202,7 @@ void __init setup_bootmem_allocator(unsigned long free_pfn)
200 if (LOADER_TYPE && INITRD_START) { 202 if (LOADER_TYPE && INITRD_START) {
201 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { 203 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {
202 reserve_bootmem(INITRD_START + __MEMORY_START, 204 reserve_bootmem(INITRD_START + __MEMORY_START,
203 INITRD_SIZE); 205 INITRD_SIZE, BOOTMEM_DEFAULT);
204 initrd_start = INITRD_START + PAGE_OFFSET + 206 initrd_start = INITRD_START + PAGE_OFFSET +
205 __MEMORY_START; 207 __MEMORY_START;
206 initrd_end = initrd_start + INITRD_SIZE; 208 initrd_end = initrd_start + INITRD_SIZE;
diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c
index 8aff065dd307..2de7302724fc 100644
--- a/arch/sh/mm/numa.c
+++ b/arch/sh/mm/numa.c
@@ -80,9 +80,9 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
80 80
81 /* Reserve the pgdat and bootmap space with the bootmem allocator */ 81 /* Reserve the pgdat and bootmap space with the bootmem allocator */
82 reserve_bootmem_node(NODE_DATA(nid), start_pfn << PAGE_SHIFT, 82 reserve_bootmem_node(NODE_DATA(nid), start_pfn << PAGE_SHIFT,
83 sizeof(struct pglist_data)); 83 sizeof(struct pglist_data), BOOTMEM_DEFAULT);
84 reserve_bootmem_node(NODE_DATA(nid), free_pfn << PAGE_SHIFT, 84 reserve_bootmem_node(NODE_DATA(nid), free_pfn << PAGE_SHIFT,
85 bootmap_pages << PAGE_SHIFT); 85 bootmap_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
86 86
87 /* It's up */ 87 /* It's up */
88 node_set_online(nid); 88 node_set_online(nid);
diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init.c
index a1bef07755a9..b89837accc88 100644
--- a/arch/sparc/mm/init.c
+++ b/arch/sparc/mm/init.c
@@ -259,7 +259,7 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
259 if (initrd_start) { 259 if (initrd_start) {
260 /* Reserve the initrd image area. */ 260 /* Reserve the initrd image area. */
261 size = initrd_end - initrd_start; 261 size = initrd_end - initrd_start;
262 reserve_bootmem(initrd_start, size); 262 reserve_bootmem(initrd_start, size, BOOTMEM_DEFAULT);
263 *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; 263 *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT;
264 264
265 initrd_start = (initrd_start - phys_base) + PAGE_OFFSET; 265 initrd_start = (initrd_start - phys_base) + PAGE_OFFSET;
@@ -268,7 +268,7 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
268#endif 268#endif
269 /* Reserve the kernel text/data/bss. */ 269 /* Reserve the kernel text/data/bss. */
270 size = (start_pfn << PAGE_SHIFT) - phys_base; 270 size = (start_pfn << PAGE_SHIFT) - phys_base;
271 reserve_bootmem(phys_base, size); 271 reserve_bootmem(phys_base, size, BOOTMEM_DEFAULT);
272 *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; 272 *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT;
273 273
274 /* Reserve the bootmem map. We do not account for it 274 /* Reserve the bootmem map. We do not account for it
@@ -276,7 +276,7 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
276 * in free_all_bootmem. 276 * in free_all_bootmem.
277 */ 277 */
278 size = bootmap_size; 278 size = bootmap_size;
279 reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size); 279 reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size, BOOTMEM_DEFAULT);
280 *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; 280 *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT;
281 281
282 return max_pfn; 282 return max_pfn;
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 523e993ee90c..e726c45645ff 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -997,7 +997,7 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
997 prom_printf("reserve_bootmem(initrd): base[%llx] size[%lx]\n", 997 prom_printf("reserve_bootmem(initrd): base[%llx] size[%lx]\n",
998 initrd_start, initrd_end); 998 initrd_start, initrd_end);
999#endif 999#endif
1000 reserve_bootmem(initrd_start, size); 1000 reserve_bootmem(initrd_start, size, BOOTMEM_DEFAULT);
1001 1001
1002 initrd_start += PAGE_OFFSET; 1002 initrd_start += PAGE_OFFSET;
1003 initrd_end += PAGE_OFFSET; 1003 initrd_end += PAGE_OFFSET;
@@ -1007,7 +1007,7 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
1007#ifdef CONFIG_DEBUG_BOOTMEM 1007#ifdef CONFIG_DEBUG_BOOTMEM
1008 prom_printf("reserve_bootmem(kernel): base[%lx] size[%lx]\n", kern_base, kern_size); 1008 prom_printf("reserve_bootmem(kernel): base[%lx] size[%lx]\n", kern_base, kern_size);
1009#endif 1009#endif
1010 reserve_bootmem(kern_base, kern_size); 1010 reserve_bootmem(kern_base, kern_size, BOOTMEM_DEFAULT);
1011 *pages_avail -= PAGE_ALIGN(kern_size) >> PAGE_SHIFT; 1011 *pages_avail -= PAGE_ALIGN(kern_size) >> PAGE_SHIFT;
1012 1012
1013 /* Add back in the initmem pages. */ 1013 /* Add back in the initmem pages. */
@@ -1024,7 +1024,7 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
1024 prom_printf("reserve_bootmem(bootmap): base[%lx] size[%lx]\n", 1024 prom_printf("reserve_bootmem(bootmap): base[%lx] size[%lx]\n",
1025 (bootmap_pfn << PAGE_SHIFT), size); 1025 (bootmap_pfn << PAGE_SHIFT), size);
1026#endif 1026#endif
1027 reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size); 1027 reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size, BOOTMEM_DEFAULT);
1028 1028
1029 for (i = 0; i < pavail_ents; i++) { 1029 for (i = 0; i < pavail_ents; i++) {
1030 unsigned long start_pfn, end_pfn; 1030 unsigned long start_pfn, end_pfn;
@@ -1489,7 +1489,7 @@ static void __init taint_real_pages(void)
1489 goto do_next_page; 1489 goto do_next_page;
1490 } 1490 }
1491 } 1491 }
1492 reserve_bootmem(old_start, PAGE_SIZE); 1492 reserve_bootmem(old_start, PAGE_SIZE, BOOTMEM_DEFAULT);
1493 1493
1494 do_next_page: 1494 do_next_page:
1495 old_start += PAGE_SIZE; 1495 old_start += PAGE_SIZE;
diff --git a/arch/v850/kernel/anna.c b/arch/v850/kernel/anna.c
index 0e429041a117..5978a25170fb 100644
--- a/arch/v850/kernel/anna.c
+++ b/arch/v850/kernel/anna.c
@@ -85,7 +85,8 @@ void __init mach_reserve_bootmem ()
85 /* The space between SRAM and SDRAM is filled with duplicate 85 /* The space between SRAM and SDRAM is filled with duplicate
86 images of SRAM. Prevent the kernel from using them. */ 86 images of SRAM. Prevent the kernel from using them. */
87 reserve_bootmem (SRAM_ADDR + SRAM_SIZE, 87 reserve_bootmem (SRAM_ADDR + SRAM_SIZE,
88 SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE)); 88 SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE),
89 BOOTMEM_DEFAULT);
89} 90}
90 91
91void mach_gettimeofday (struct timespec *tv) 92void mach_gettimeofday (struct timespec *tv)
diff --git a/arch/v850/kernel/as85ep1.c b/arch/v850/kernel/as85ep1.c
index 18437bc5c3ad..b525ecf3aea4 100644
--- a/arch/v850/kernel/as85ep1.c
+++ b/arch/v850/kernel/as85ep1.c
@@ -116,7 +116,8 @@ void __init mach_reserve_bootmem ()
116 if (SDRAM_ADDR < RAM_END && SDRAM_ADDR > RAM_START) 116 if (SDRAM_ADDR < RAM_END && SDRAM_ADDR > RAM_START)
117 /* We can't use the space between SRAM and SDRAM, so 117 /* We can't use the space between SRAM and SDRAM, so
118 prevent the kernel from trying. */ 118 prevent the kernel from trying. */
119 reserve_bootmem (SRAM_END, SDRAM_ADDR - SRAM_END); 119 reserve_bootmem(SRAM_END, SDRAM_ADDR - SRAM_END,
120 BOOTMEM_DEFAULT);
120} 121}
121 122
122void mach_gettimeofday (struct timespec *tv) 123void mach_gettimeofday (struct timespec *tv)
diff --git a/arch/v850/kernel/rte_ma1_cb.c b/arch/v850/kernel/rte_ma1_cb.c
index 9a716f946421..08abf3d5f8df 100644
--- a/arch/v850/kernel/rte_ma1_cb.c
+++ b/arch/v850/kernel/rte_ma1_cb.c
@@ -46,13 +46,15 @@ void __init mach_reserve_bootmem ()
46{ 46{
47#ifdef CONFIG_RTE_CB_MULTI 47#ifdef CONFIG_RTE_CB_MULTI
48 /* Prevent the kernel from touching the monitor's scratch RAM. */ 48 /* Prevent the kernel from touching the monitor's scratch RAM. */
49 reserve_bootmem (MON_SCRATCH_ADDR, MON_SCRATCH_SIZE); 49 reserve_bootmem(MON_SCRATCH_ADDR, MON_SCRATCH_SIZE,
50 BOOTMEM_DEFAULT);
50#endif 51#endif
51 52
52 /* The space between SRAM and SDRAM is filled with duplicate 53 /* The space between SRAM and SDRAM is filled with duplicate
53 images of SRAM. Prevent the kernel from using them. */ 54 images of SRAM. Prevent the kernel from using them. */
54 reserve_bootmem (SRAM_ADDR + SRAM_SIZE, 55 reserve_bootmem (SRAM_ADDR + SRAM_SIZE,
55 SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE)); 56 SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE),
57 BOOTMEM_DEFAULT);
56} 58}
57 59
58void mach_gettimeofday (struct timespec *tv) 60void mach_gettimeofday (struct timespec *tv)
diff --git a/arch/v850/kernel/setup.c b/arch/v850/kernel/setup.c
index a914f244f494..a0a8456a8430 100644
--- a/arch/v850/kernel/setup.c
+++ b/arch/v850/kernel/setup.c
@@ -241,15 +241,18 @@ init_bootmem_alloc (unsigned long ram_start, unsigned long ram_len)
241 if (kram_end > kram_start) 241 if (kram_end > kram_start)
242 /* Reserve the RAM part of the kernel's address space, so it 242 /* Reserve the RAM part of the kernel's address space, so it
243 doesn't get allocated. */ 243 doesn't get allocated. */
244 reserve_bootmem (kram_start, kram_end - kram_start); 244 reserve_bootmem(kram_start, kram_end - kram_start,
245 BOOTMEM_DEFAULT);
245 246
246 if (intv_in_ram && !intv_in_kram) 247 if (intv_in_ram && !intv_in_kram)
247 /* Reserve the interrupt vector space. */ 248 /* Reserve the interrupt vector space. */
248 reserve_bootmem (intv_start, intv_end - intv_start); 249 reserve_bootmem(intv_start, intv_end - intv_start,
250 BOOTMEM_DEFAULT);
249 251
250 if (bootmap >= ram_start && bootmap < ram_end) 252 if (bootmap >= ram_start && bootmap < ram_end)
251 /* Reserve the bootmap space. */ 253 /* Reserve the bootmap space. */
252 reserve_bootmem (bootmap, bootmap_len); 254 reserve_bootmem(bootmap, bootmap_len,
255 BOOTMEM_DEFAULT);
253 256
254 /* Reserve the memory used by the root filesystem image if it's 257 /* Reserve the memory used by the root filesystem image if it's
255 in RAM. */ 258 in RAM. */
@@ -257,7 +260,8 @@ init_bootmem_alloc (unsigned long ram_start, unsigned long ram_len)
257 && (unsigned long)&_root_fs_image_start >= ram_start 260 && (unsigned long)&_root_fs_image_start >= ram_start
258 && (unsigned long)&_root_fs_image_start < ram_end) 261 && (unsigned long)&_root_fs_image_start < ram_end)
259 reserve_bootmem ((unsigned long)&_root_fs_image_start, 262 reserve_bootmem ((unsigned long)&_root_fs_image_start,
260 &_root_fs_image_end - &_root_fs_image_start); 263 &_root_fs_image_end - &_root_fs_image_start,
264 BOOTMEM_DEFAULT);
261 265
262 /* Let the platform-dependent code reserve some too. */ 266 /* Let the platform-dependent code reserve some too. */
263 if (mrb) 267 if (mrb)
diff --git a/arch/x86/kernel/mpparse_32.c b/arch/x86/kernel/mpparse_32.c
index 67009cdd5eca..f349e68e45a0 100644
--- a/arch/x86/kernel/mpparse_32.c
+++ b/arch/x86/kernel/mpparse_32.c
@@ -736,7 +736,8 @@ static int __init smp_scan_config (unsigned long base, unsigned long length)
736 smp_found_config = 1; 736 smp_found_config = 1;
737 printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n", 737 printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n",
738 mpf, virt_to_phys(mpf)); 738 mpf, virt_to_phys(mpf));
739 reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE); 739 reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE,
740 BOOTMEM_DEFAULT);
740 if (mpf->mpf_physptr) { 741 if (mpf->mpf_physptr) {
741 /* 742 /*
742 * We cannot access to MPC table to compute 743 * We cannot access to MPC table to compute
@@ -751,7 +752,8 @@ static int __init smp_scan_config (unsigned long base, unsigned long length)
751 unsigned long end = max_low_pfn * PAGE_SIZE; 752 unsigned long end = max_low_pfn * PAGE_SIZE;
752 if (mpf->mpf_physptr + size > end) 753 if (mpf->mpf_physptr + size > end)
753 size = end - mpf->mpf_physptr; 754 size = end - mpf->mpf_physptr;
754 reserve_bootmem(mpf->mpf_physptr, size); 755 reserve_bootmem(mpf->mpf_physptr, size,
756 BOOTMEM_DEFAULT);
755 } 757 }
756 758
757 mpf_found = mpf; 759 mpf_found = mpf;
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index 62adc5f20be5..d1d8c347cc0b 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -390,7 +390,7 @@ static void __init reserve_ebda_region(void)
390 unsigned int addr; 390 unsigned int addr;
391 addr = get_bios_ebda(); 391 addr = get_bios_ebda();
392 if (addr) 392 if (addr)
393 reserve_bootmem(addr, PAGE_SIZE); 393 reserve_bootmem(addr, PAGE_SIZE, BOOTMEM_DEFAULT);
394} 394}
395 395
396#ifndef CONFIG_NEED_MULTIPLE_NODES 396#ifndef CONFIG_NEED_MULTIPLE_NODES
@@ -484,7 +484,8 @@ static void __init reserve_crashkernel(void)
484 (unsigned long)(total_mem >> 20)); 484 (unsigned long)(total_mem >> 20));
485 crashk_res.start = crash_base; 485 crashk_res.start = crash_base;
486 crashk_res.end = crash_base + crash_size - 1; 486 crashk_res.end = crash_base + crash_size - 1;
487 reserve_bootmem(crash_base, crash_size); 487 reserve_bootmem(crash_base, crash_size,
488 BOOTMEM_DEFAULT);
488 } else 489 } else
489 printk(KERN_INFO "crashkernel reservation failed - " 490 printk(KERN_INFO "crashkernel reservation failed - "
490 "you have to specify a base address\n"); 491 "you have to specify a base address\n");
@@ -525,7 +526,7 @@ static void __init reserve_initrd(void)
525 } 526 }
526 if (ramdisk_end <= end_of_lowmem) { 527 if (ramdisk_end <= end_of_lowmem) {
527 /* All in lowmem, easy case */ 528 /* All in lowmem, easy case */
528 reserve_bootmem(ramdisk_image, ramdisk_size); 529 reserve_bootmem(ramdisk_image, ramdisk_size, BOOTMEM_DEFAULT);
529 initrd_start = ramdisk_image + PAGE_OFFSET; 530 initrd_start = ramdisk_image + PAGE_OFFSET;
530 initrd_end = initrd_start+ramdisk_size; 531 initrd_end = initrd_start+ramdisk_size;
531 return; 532 return;
@@ -536,7 +537,7 @@ static void __init reserve_initrd(void)
536 537
537 /* Note: this includes all the lowmem currently occupied by 538 /* Note: this includes all the lowmem currently occupied by
538 the initrd, we rely on that fact to keep the data intact. */ 539 the initrd, we rely on that fact to keep the data intact. */
539 reserve_bootmem(ramdisk_here, ramdisk_size); 540 reserve_bootmem(ramdisk_here, ramdisk_size, BOOTMEM_DEFAULT);
540 initrd_start = ramdisk_here + PAGE_OFFSET; 541 initrd_start = ramdisk_here + PAGE_OFFSET;
541 initrd_end = initrd_start + ramdisk_size; 542 initrd_end = initrd_start + ramdisk_size;
542 543
@@ -606,13 +607,14 @@ void __init setup_bootmem_allocator(void)
606 * bootmem allocator with an invalid RAM area. 607 * bootmem allocator with an invalid RAM area.
607 */ 608 */
608 reserve_bootmem(__pa_symbol(_text), (PFN_PHYS(min_low_pfn) + 609 reserve_bootmem(__pa_symbol(_text), (PFN_PHYS(min_low_pfn) +
609 bootmap_size + PAGE_SIZE-1) - __pa_symbol(_text)); 610 bootmap_size + PAGE_SIZE-1) - __pa_symbol(_text),
611 BOOTMEM_DEFAULT);
610 612
611 /* 613 /*
612 * reserve physical page 0 - it's a special BIOS page on many boxes, 614 * reserve physical page 0 - it's a special BIOS page on many boxes,
613 * enabling clean reboots, SMP operation, laptop functions. 615 * enabling clean reboots, SMP operation, laptop functions.
614 */ 616 */
615 reserve_bootmem(0, PAGE_SIZE); 617 reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT);
616 618
617 /* reserve EBDA region, it's a 4K region */ 619 /* reserve EBDA region, it's a 4K region */
618 reserve_ebda_region(); 620 reserve_ebda_region();
@@ -622,7 +624,7 @@ void __init setup_bootmem_allocator(void)
622 unless you have no PS/2 mouse plugged in. */ 624 unless you have no PS/2 mouse plugged in. */
623 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD && 625 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
624 boot_cpu_data.x86 == 6) 626 boot_cpu_data.x86 == 6)
625 reserve_bootmem(0xa0000 - 4096, 4096); 627 reserve_bootmem(0xa0000 - 4096, 4096, BOOTMEM_DEFAULT);
626 628
627#ifdef CONFIG_SMP 629#ifdef CONFIG_SMP
628 /* 630 /*
@@ -630,7 +632,7 @@ void __init setup_bootmem_allocator(void)
630 * FIXME: Don't need the extra page at 4K, but need to fix 632 * FIXME: Don't need the extra page at 4K, but need to fix
631 * trampoline before removing it. (see the GDT stuff) 633 * trampoline before removing it. (see the GDT stuff)
632 */ 634 */
633 reserve_bootmem(PAGE_SIZE, PAGE_SIZE); 635 reserve_bootmem(PAGE_SIZE, PAGE_SIZE, BOOTMEM_DEFAULT);
634#endif 636#endif
635#ifdef CONFIG_ACPI_SLEEP 637#ifdef CONFIG_ACPI_SLEEP
636 /* 638 /*
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index c8939dfddfba..8345c3b12f05 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -189,7 +189,7 @@ contig_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
189 bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, end_pfn); 189 bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, end_pfn);
190 e820_register_active_regions(0, start_pfn, end_pfn); 190 e820_register_active_regions(0, start_pfn, end_pfn);
191 free_bootmem_with_active_regions(0, end_pfn); 191 free_bootmem_with_active_regions(0, end_pfn);
192 reserve_bootmem(bootmap, bootmap_size); 192 reserve_bootmem(bootmap, bootmap_size, BOOTMEM_DEFAULT);
193} 193}
194#endif 194#endif
195 195
@@ -238,7 +238,8 @@ static void __init reserve_crashkernel(void)
238 (unsigned long)(free_mem >> 20)); 238 (unsigned long)(free_mem >> 20));
239 crashk_res.start = crash_base; 239 crashk_res.start = crash_base;
240 crashk_res.end = crash_base + crash_size - 1; 240 crashk_res.end = crash_base + crash_size - 1;
241 reserve_bootmem(crash_base, crash_size); 241 reserve_bootmem(crash_base, crash_size,
242 BOOTMEM_DEFAULT);
242 } else 243 } else
243 printk(KERN_INFO "crashkernel reservation failed - " 244 printk(KERN_INFO "crashkernel reservation failed - "
244 "you have to specify a base address\n"); 245 "you have to specify a base address\n");
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c
index 04b1d20e2613..c394ca0720b8 100644
--- a/arch/x86/mm/discontig_32.c
+++ b/arch/x86/mm/discontig_32.c
@@ -391,7 +391,8 @@ unsigned long __init setup_memory(void)
391void __init numa_kva_reserve(void) 391void __init numa_kva_reserve(void)
392{ 392{
393 if (kva_pages) 393 if (kva_pages)
394 reserve_bootmem(PFN_PHYS(kva_start_pfn), PFN_PHYS(kva_pages)); 394 reserve_bootmem(PFN_PHYS(kva_start_pfn), PFN_PHYS(kva_pages),
395 BOOTMEM_DEFAULT);
395} 396}
396 397
397void __init zone_sizes_init(void) 398void __init zone_sizes_init(void)
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 9b61c75a2355..5fe880fc305d 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -644,9 +644,9 @@ void __init reserve_bootmem_generic(unsigned long phys, unsigned len)
644 644
645 /* Should check here against the e820 map to avoid double free */ 645 /* Should check here against the e820 map to avoid double free */
646#ifdef CONFIG_NUMA 646#ifdef CONFIG_NUMA
647 reserve_bootmem_node(NODE_DATA(nid), phys, len); 647 reserve_bootmem_node(NODE_DATA(nid), phys, len, BOOTMEM_DEFAULT);
648#else 648#else
649 reserve_bootmem(phys, len); 649 reserve_bootmem(phys, len, BOOTMEM_DEFAULT);
650#endif 650#endif
651 if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) { 651 if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) {
652 dma_reserve += len / PAGE_SIZE; 652 dma_reserve += len / PAGE_SIZE;
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 5a02bf4c91ec..1aecc658cd7d 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -238,9 +238,10 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
238 238
239 free_bootmem_with_active_regions(nodeid, end); 239 free_bootmem_with_active_regions(nodeid, end);
240 240
241 reserve_bootmem_node(NODE_DATA(nodeid), nodedata_phys, pgdat_size); 241 reserve_bootmem_node(NODE_DATA(nodeid), nodedata_phys, pgdat_size,
242 BOOTMEM_DEFAULT);
242 reserve_bootmem_node(NODE_DATA(nodeid), bootmap_start, 243 reserve_bootmem_node(NODE_DATA(nodeid), bootmap_start,
243 bootmap_pages<<PAGE_SHIFT); 244 bootmap_pages<<PAGE_SHIFT, BOOTMEM_DEFAULT);
244#ifdef CONFIG_ACPI_NUMA 245#ifdef CONFIG_ACPI_NUMA
245 srat_reserve_add_area(nodeid); 246 srat_reserve_add_area(nodeid);
246#endif 247#endif
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index 65416f843e59..ecd91ea8a8ae 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -488,7 +488,8 @@ void __init srat_reserve_add_area(int nodeid)
488 printk(KERN_INFO "SRAT: This will cost you %Lu MB of " 488 printk(KERN_INFO "SRAT: This will cost you %Lu MB of "
489 "pre-allocated memory.\n", (unsigned long long)total_mb); 489 "pre-allocated memory.\n", (unsigned long long)total_mb);
490 reserve_bootmem_node(NODE_DATA(nodeid), nodes_add[nodeid].start, 490 reserve_bootmem_node(NODE_DATA(nodeid), nodes_add[nodeid].start,
491 nodes_add[nodeid].end - nodes_add[nodeid].start); 491 nodes_add[nodeid].end - nodes_add[nodeid].start,
492 BOOTMEM_DEFAULT);
492 } 493 }
493} 494}
494 495
diff --git a/include/asm-x86/mmzone_32.h b/include/asm-x86/mmzone_32.h
index 5d6f4ce6e6d6..274a59566c45 100644
--- a/include/asm-x86/mmzone_32.h
+++ b/include/asm-x86/mmzone_32.h
@@ -107,8 +107,8 @@ static inline int pfn_valid(int pfn)
107/* 107/*
108 * Following are macros that are specific to this numa platform. 108 * Following are macros that are specific to this numa platform.
109 */ 109 */
110#define reserve_bootmem(addr, size) \ 110#define reserve_bootmem(addr, size, flags) \
111 reserve_bootmem_node(NODE_DATA(0), (addr), (size)) 111 reserve_bootmem_node(NODE_DATA(0), (addr), (size), (flags))
112#define alloc_bootmem(x) \ 112#define alloc_bootmem(x) \
113 __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 113 __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
114#define alloc_bootmem_low(x) \ 114#define alloc_bootmem_low(x) \
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 0365ec9fc0c9..4e4e340592fb 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -60,8 +60,20 @@ extern void *__alloc_bootmem_core(struct bootmem_data *bdata,
60 unsigned long goal, 60 unsigned long goal,
61 unsigned long limit); 61 unsigned long limit);
62 62
63/*
64 * flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE,
65 * the architecture-specific code should honor this)
66 */
67#define BOOTMEM_DEFAULT 0
68#define BOOTMEM_EXCLUSIVE (1<<0)
69
63#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 70#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
64extern void reserve_bootmem(unsigned long addr, unsigned long size); 71/*
72 * If flags is 0, then the return value is always 0 (success). If
73 * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the
74 * memory already was reserved.
75 */
76extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags);
65#define alloc_bootmem(x) \ 77#define alloc_bootmem(x) \
66 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 78 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
67#define alloc_bootmem_low(x) \ 79#define alloc_bootmem_low(x) \
@@ -84,7 +96,8 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
84 unsigned long endpfn); 96 unsigned long endpfn);
85extern void reserve_bootmem_node(pg_data_t *pgdat, 97extern void reserve_bootmem_node(pg_data_t *pgdat,
86 unsigned long physaddr, 98 unsigned long physaddr,
87 unsigned long size); 99 unsigned long size,
100 int flags);
88extern void free_bootmem_node(pg_data_t *pgdat, 101extern void free_bootmem_node(pg_data_t *pgdat,
89 unsigned long addr, 102 unsigned long addr,
90 unsigned long size); 103 unsigned long size);
diff --git a/mm/bootmem.c b/mm/bootmem.c
index 00a96970b237..f6ff4337b424 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -111,11 +111,12 @@ static unsigned long __init init_bootmem_core(pg_data_t *pgdat,
111 * might be used for boot-time allocations - or it might get added 111 * might be used for boot-time allocations - or it might get added
112 * to the free page pool later on. 112 * to the free page pool later on.
113 */ 113 */
114static void __init reserve_bootmem_core(bootmem_data_t *bdata, unsigned long addr, 114static int __init reserve_bootmem_core(bootmem_data_t *bdata,
115 unsigned long size) 115 unsigned long addr, unsigned long size, int flags)
116{ 116{
117 unsigned long sidx, eidx; 117 unsigned long sidx, eidx;
118 unsigned long i; 118 unsigned long i;
119 int ret;
119 120
120 /* 121 /*
121 * round up, partially reserved pages are considered 122 * round up, partially reserved pages are considered
@@ -133,7 +134,20 @@ static void __init reserve_bootmem_core(bootmem_data_t *bdata, unsigned long add
133#ifdef CONFIG_DEBUG_BOOTMEM 134#ifdef CONFIG_DEBUG_BOOTMEM
134 printk("hm, page %08lx reserved twice.\n", i*PAGE_SIZE); 135 printk("hm, page %08lx reserved twice.\n", i*PAGE_SIZE);
135#endif 136#endif
137 if (flags & BOOTMEM_EXCLUSIVE) {
138 ret = -EBUSY;
139 goto err;
140 }
136 } 141 }
142
143 return 0;
144
145err:
146 /* unreserve memory we accidentally reserved */
147 for (i--; i >= sidx; i--)
148 clear_bit(i, bdata->node_bootmem_map);
149
150 return ret;
137} 151}
138 152
139static void __init free_bootmem_core(bootmem_data_t *bdata, unsigned long addr, 153static void __init free_bootmem_core(bootmem_data_t *bdata, unsigned long addr,
@@ -374,9 +388,9 @@ unsigned long __init init_bootmem_node(pg_data_t *pgdat, unsigned long freepfn,
374} 388}
375 389
376void __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, 390void __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
377 unsigned long size) 391 unsigned long size, int flags)
378{ 392{
379 reserve_bootmem_core(pgdat->bdata, physaddr, size); 393 reserve_bootmem_core(pgdat->bdata, physaddr, size, flags);
380} 394}
381 395
382void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, 396void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
@@ -398,9 +412,10 @@ unsigned long __init init_bootmem(unsigned long start, unsigned long pages)
398} 412}
399 413
400#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 414#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
401void __init reserve_bootmem(unsigned long addr, unsigned long size) 415int __init reserve_bootmem(unsigned long addr, unsigned long size,
416 int flags)
402{ 417{
403 reserve_bootmem_core(NODE_DATA(0)->bdata, addr, size); 418 return reserve_bootmem_core(NODE_DATA(0)->bdata, addr, size, flags);
404} 419}
405#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 420#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
406 421