Introduce flags for reserve_bootmem()
authorBernhard Walle <bwalle@suse.de>
Thu, 7 Feb 2008 08:15:17 +0000 (00:15 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 7 Feb 2008 16:42:25 +0000 (08:42 -0800)
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>
43 files changed:
arch/alpha/kernel/core_irongate.c
arch/alpha/kernel/setup.c
arch/alpha/mm/numa.c
arch/arm/mm/init.c
arch/arm/mm/mmu.c
arch/arm/mm/nommu.c
arch/arm/plat-omap/fb.c
arch/avr32/kernel/setup.c
arch/blackfin/kernel/setup.c
arch/cris/kernel/setup.c
arch/frv/kernel/setup.c
arch/h8300/kernel/setup.c
arch/ia64/mm/contig.c
arch/ia64/mm/discontig.c
arch/m32r/kernel/setup.c
arch/m32r/mm/discontig.c
arch/m68k/atari/stram.c
arch/m68k/kernel/setup.c
arch/m68knommu/kernel/setup.c
arch/mips/kernel/setup.c
arch/mips/sgi-ip27/ip27-memory.c
arch/parisc/mm/init.c
arch/powerpc/mm/mem.c
arch/powerpc/mm/numa.c
arch/s390/kernel/setup.c
arch/sh/kernel/setup.c
arch/sh/mm/numa.c
arch/sparc/mm/init.c
arch/sparc64/mm/init.c
arch/v850/kernel/anna.c
arch/v850/kernel/as85ep1.c
arch/v850/kernel/rte_ma1_cb.c
arch/v850/kernel/setup.c
arch/x86/kernel/mpparse_32.c
arch/x86/kernel/setup_32.c
arch/x86/kernel/setup_64.c
arch/x86/mm/discontig_32.c
arch/x86/mm/init_64.c
arch/x86/mm/numa_64.c
arch/x86/mm/srat_64.c
include/asm-x86/mmzone_32.h
include/linux/bootmem.h
mm/bootmem.c

index e4a0bcf1d28b6834492808c0cf52b4681e3b0182..a872078497be7382d37b3326597bf967708ad4a5 100644 (file)
@@ -241,7 +241,8 @@ albacore_init_arch(void)
                                       size / 1024);
                }
 #endif
-               reserve_bootmem_node(NODE_DATA(0), pci_mem, memtop - pci_mem);
+               reserve_bootmem_node(NODE_DATA(0), pci_mem, memtop -
+                               pci_mem, BOOTMEM_DEFAULT);
                printk("irongate_init_arch: temporarily reserving "
                        "region %08lx-%08lx for PCI\n", pci_mem, memtop - 1);
        }
index beff6297f788a029aa7423bc2a615915a764126d..74c3466256586800730be7e19c94421a2050b877 100644 (file)
@@ -428,7 +428,8 @@ setup_memory(void *kernel_end)
        }
 
        /* Reserve the bootmap memory.  */
-       reserve_bootmem(PFN_PHYS(bootmap_start), bootmap_size);
+       reserve_bootmem(PFN_PHYS(bootmap_start), bootmap_size,
+                       BOOTMEM_DEFAULT);
        printk("reserving pages %ld:%ld\n", bootmap_start, bootmap_start+PFN_UP(bootmap_size));
 
 #ifdef CONFIG_BLK_DEV_INITRD
@@ -446,7 +447,7 @@ setup_memory(void *kernel_end)
                                       phys_to_virt(PFN_PHYS(max_low_pfn)));
                } else {
                        reserve_bootmem(virt_to_phys((void *)initrd_start),
-                                       INITRD_SIZE);
+                                       INITRD_SIZE, BOOTMEM_DEFAULT);
                }
        }
 #endif /* CONFIG_BLK_DEV_INITRD */
index e3e3806a6f254f02b3cec0d1a02fba5fc05639c2..10ab7833e83ca660c7292869e501434251e4bdba 100644 (file)
@@ -242,7 +242,8 @@ setup_memory_node(int nid, void *kernel_end)
        }
 
        /* Reserve the bootmap memory.  */
-       reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(bootmap_start), bootmap_size);
+       reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(bootmap_start),
+                       bootmap_size, BOOTMEM_DEFAULT);
        printk(" reserving pages %ld:%ld\n", bootmap_start, bootmap_start+PFN_UP(bootmap_size));
 
        node_set_online(nid);
@@ -281,7 +282,7 @@ setup_memory(void *kernel_end)
                        nid = kvaddr_to_nid(initrd_start);
                        reserve_bootmem_node(NODE_DATA(nid),
                                             virt_to_phys((void *)initrd_start),
-                                            INITRD_SIZE);
+                                            INITRD_SIZE, BOOTMEM_DEFAULT);
                }
        }
 #endif /* CONFIG_BLK_DEV_INITRD */
index c0ad7c0fbae0c83f74906bc08f0f09d4e2e59731..ec00f26bffa4825c5ee61bf6c4f635f992550949 100644 (file)
@@ -239,7 +239,7 @@ bootmem_init_node(int node, int initrd_node, struct meminfo *mi)
         * Reserve the bootmem bitmap for this node.
         */
        reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT,
-                            boot_pages << PAGE_SHIFT);
+                            boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
 
 #ifdef CONFIG_BLK_DEV_INITRD
        /*
@@ -247,7 +247,7 @@ bootmem_init_node(int node, int initrd_node, struct meminfo *mi)
         */
        if (node == initrd_node) {
                reserve_bootmem_node(pgdat, phys_initrd_start,
-                                    phys_initrd_size);
+                                    phys_initrd_size, BOOTMEM_DEFAULT);
                initrd_start = __phys_to_virt(phys_initrd_start);
                initrd_end = initrd_start + phys_initrd_size;
        }
index e5d61ee3d4a1bec9c309f3ba7b91de8ce4f9cb53..d41a75ed3dce27431fd11c78f7cf27553bbbe61c 100644 (file)
@@ -605,9 +605,11 @@ void __init reserve_node_zero(pg_data_t *pgdat)
         * Note that this can only be in node 0.
         */
 #ifdef CONFIG_XIP_KERNEL
-       reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start);
+       reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start,
+                       BOOTMEM_DEFAULT);
 #else
-       reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext);
+       reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext,
+                       BOOTMEM_DEFAULT);
 #endif
 
        /*
@@ -615,7 +617,7 @@ void __init reserve_node_zero(pg_data_t *pgdat)
         * and can only be in node 0.
         */
        reserve_bootmem_node(pgdat, __pa(swapper_pg_dir),
-                            PTRS_PER_PGD * sizeof(pgd_t));
+                            PTRS_PER_PGD * sizeof(pgd_t), BOOTMEM_DEFAULT);
 
        /*
         * Hmm... This should go elsewhere, but we really really need to
@@ -638,8 +640,10 @@ void __init reserve_node_zero(pg_data_t *pgdat)
        /* H1940 and RX3715 need to reserve this for suspend */
 
        if (machine_is_h1940() || machine_is_rx3715()) {
-               reserve_bootmem_node(pgdat, 0x30003000, 0x1000);
-               reserve_bootmem_node(pgdat, 0x30081000, 0x1000);
+               reserve_bootmem_node(pgdat, 0x30003000, 0x1000,
+                               BOOTMEM_DEFAULT);
+               reserve_bootmem_node(pgdat, 0x30081000, 0x1000,
+                               BOOTMEM_DEFAULT);
        }
 
 #ifdef CONFIG_SA1111
@@ -650,7 +654,8 @@ void __init reserve_node_zero(pg_data_t *pgdat)
        res_size = __pa(swapper_pg_dir) - PHYS_OFFSET;
 #endif
        if (res_size)
-               reserve_bootmem_node(pgdat, PHYS_OFFSET, res_size);
+               reserve_bootmem_node(pgdat, PHYS_OFFSET, res_size,
+                               BOOTMEM_DEFAULT);
 }
 
 /*
index 8cd3a60954f0e78c53d4e0efb5eec7f5f6272e88..63c62fdea52115e168751c5efa5eec96c7602341 100644 (file)
@@ -27,9 +27,11 @@ void __init reserve_node_zero(pg_data_t *pgdat)
         * Note that this can only be in node 0.
         */
 #ifdef CONFIG_XIP_KERNEL
-       reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start);
+       reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start,
+                       BOOTMEM_DEFAULT);
 #else
-       reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext);
+       reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext,
+                       BOOTMEM_DEFAULT);
 #endif
 
        /*
@@ -37,7 +39,8 @@ void __init reserve_node_zero(pg_data_t *pgdat)
         * some architectures which the DRAM is the exception vector to trap,
         * alloc_page breaks with error, although it is not NULL, but "0."
         */
-       reserve_bootmem_node(pgdat, CONFIG_VECTORS_BASE, PAGE_SIZE);
+       reserve_bootmem_node(pgdat, CONFIG_VECTORS_BASE, PAGE_SIZE,
+                       BOOTMEM_DEFAULT);
 }
 
 /*
index ee40c1a0b83d6788f24bd66b8530661b357c5b07..7854f19b77cf6588b23762632c4c3efddd9b0ac4 100644 (file)
@@ -207,7 +207,7 @@ void __init omapfb_reserve_sdram(void)
                        return;
                }
                if (rg.paddr)
-                       reserve_bootmem(rg.paddr, rg.size);
+                       reserve_bootmem(rg.paddr, rg.size, BOOTMEM_DEFAULT);
                reserved += rg.size;
                omapfb_config.mem_desc.region[i] = rg;
                configured_regions++;
index 4b4c1884e1c5a4c7546eebf9ee39dcdf500e9781..e66a07a928cd6f7e10cb4798e61a46de75e492b3 100644 (file)
@@ -489,7 +489,8 @@ static void __init setup_bootmem(void)
                /* Reserve space for the bootmem bitmap... */
                reserve_bootmem_node(NODE_DATA(node),
                                     PFN_PHYS(bootmap_pfn),
-                                    bootmap_size);
+                                    bootmap_size,
+                                    BOOTMEM_DEFAULT);
 
                /* ...and any other reserved regions. */
                for (res = reserved; res; res = res->sibling) {
@@ -505,7 +506,8 @@ static void __init setup_bootmem(void)
                            && res->end < PFN_PHYS(max_pfn))
                                reserve_bootmem_node(
                                        NODE_DATA(node), res->start,
-                                       res->end - res->start + 1);
+                                       res->end - res->start + 1,
+                                       BOOTMEM_DEFAULT);
                }
 
                node_set_online(node);
index 462cae8937579a0b5207aa54963f2a474aeb1b12..6e106b3d7729f2f8832107babf496d69ed6c4c91 100644 (file)
@@ -406,7 +406,7 @@ void __init setup_arch(char **cmdline_p)
         */
        free_bootmem(memory_start, memory_end - memory_start);
 
-       reserve_bootmem(memory_start, bootmap_size);
+       reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
        /*
         * get kmalloc into gear
         */
index 65466c49d7a99ea35701aaadf1ddb4a6bac7f6b9..4da042e100a0ab3a61b22eb069a8013a04a92b1b 100644 (file)
@@ -137,7 +137,7 @@ setup_arch(char **cmdline_p)
         * Arguments are start, size
          */
 
-        reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size);
+       reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT);
 
        /* paging_init() sets up the MMU and marks all pages as reserved */
 
index b38ae1fc15fd701728d67e30e37d7370a146a2ce..6c01464db699419a2b5e8068325c1791ad356188 100644 (file)
@@ -925,13 +925,15 @@ static void __init setup_linux_memory(void)
 #endif
 
        /* take back the memory occupied by the kernel image and the bootmem alloc map */
-       reserve_bootmem(kstart, kend - kstart + bootmap_size);
+       reserve_bootmem(kstart, kend - kstart + bootmap_size,
+                       BOOTMEM_DEFAULT);
 
        /* reserve the memory occupied by the initial ramdisk */
 #ifdef CONFIG_BLK_DEV_INITRD
        if (LOADER_TYPE && INITRD_START) {
                if (INITRD_START + INITRD_SIZE <= (low_top_pfn << PAGE_SHIFT)) {
-                       reserve_bootmem(INITRD_START, INITRD_SIZE);
+                       reserve_bootmem(INITRD_START, INITRD_SIZE,
+                                       BOOTMEM_DEFAULT);
                        initrd_start = INITRD_START + PAGE_OFFSET;
                        initrd_end = initrd_start + INITRD_SIZE;
                }
@@ -986,9 +988,10 @@ static void __init setup_uclinux_memory(void)
 
        /* now take back the bits the core kernel is occupying */
 #ifndef CONFIG_PROTECT_KERNEL
-       reserve_bootmem(kend, bootmap_size);
+       reserve_bootmem(kend, bootmap_size, BOOTMEM_DEFAULT);
        reserve_bootmem((unsigned long) &__kernel_image_start,
-                       kend - (unsigned long) &__kernel_image_start);
+                       kend - (unsigned long) &__kernel_image_start,
+                       BOOTMEM_DEFAULT);
 
 #else
        dampr = __get_DAMPR(0);
@@ -996,14 +999,15 @@ static void __init setup_uclinux_memory(void)
        dampr = (dampr >> 4) + 17;
        dampr = 1 << dampr;
 
-       reserve_bootmem(__get_DAMPR(0) & xAMPRx_PPFN, dampr);
+       reserve_bootmem(__get_DAMPR(0) & xAMPRx_PPFN, dampr, BOOTMEM_DEFAULT);
 #endif
 
        /* reserve some memory to do uncached DMA through if requested */
 #ifdef CONFIG_RESERVE_DMA_COHERENT
        if (dma_coherent_mem_start)
                reserve_bootmem(dma_coherent_mem_start,
-                               dma_coherent_mem_end - dma_coherent_mem_start);
+                               dma_coherent_mem_end - dma_coherent_mem_start,
+                               BOOTMEM_DEFAULT);
 #endif
 
 } /* end setup_uclinux_memory() */
index b2e86d0255e691e7464bb786e6c16091de0bd84b..cd3734614d9df93cd21787e4adca354ef2a8ecc6 100644 (file)
@@ -173,7 +173,7 @@ void __init setup_arch(char **cmdline_p)
         * the bootmem bitmap so we then reserve it after freeing it :-)
         */
        free_bootmem(memory_start, memory_end - memory_start);
-       reserve_bootmem(memory_start, bootmap_size);
+       reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
        /*
         * get kmalloc into gear
         */
index 7e9c275ea148579b8b792583f497ae15e21927f3..344f64eca7a983cfe534afd38523ed7597e173f6 100644 (file)
@@ -218,7 +218,7 @@ find_memory (void)
 
        /* Free all available memory, then mark bootmem-map as being in use. */
        efi_memmap_walk(filter_rsvd_memory, free_bootmem);
-       reserve_bootmem(bootmap_start, bootmap_size);
+       reserve_bootmem(bootmap_start, bootmap_size, BOOTMEM_DEFAULT);
 
        find_initrd();
 
index 0b567398f38e0319568c43154f00e9fe2456a344..ee5e68b2af949db34eda7077c43409f35abf2a19 100644 (file)
@@ -299,12 +299,12 @@ static void __init reserve_pernode_space(void)
                pages = bdp->node_low_pfn - (bdp->node_boot_start>>PAGE_SHIFT);
                size = bootmem_bootmap_pages(pages) << PAGE_SHIFT;
                base = __pa(bdp->node_bootmem_map);
-               reserve_bootmem_node(pdp, base, size);
+               reserve_bootmem_node(pdp, base, size, BOOTMEM_DEFAULT);
 
                /* Now the per-node space */
                size = mem_data[node].pernode_size;
                base = __pa(mem_data[node].pernode_addr);
-               reserve_bootmem_node(pdp, base, size);
+               reserve_bootmem_node(pdp, base, size, BOOTMEM_DEFAULT);
        }
 }
 
index d64814385d705624d504333fe0b204ef63870b43..f1f5db0c40846b3b39e65368996dea3c80a952b7 100644 (file)
@@ -177,25 +177,28 @@ static unsigned long __init setup_memory(void)
         */
        reserve_bootmem(CONFIG_MEMORY_START + PAGE_SIZE,
                (PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE - 1)
-               - CONFIG_MEMORY_START);
+               - CONFIG_MEMORY_START,
+               BOOTMEM_DEFAULT);
 
        /*
         * reserve physical page 0 - it's a special BIOS page on many boxes,
         * enabling clean reboots, SMP operation, laptop functions.
         */
-       reserve_bootmem(CONFIG_MEMORY_START, PAGE_SIZE);
+       reserve_bootmem(CONFIG_MEMORY_START, PAGE_SIZE, BOOTMEM_DEFAULT);
 
        /*
         * reserve memory hole
         */
 #ifdef CONFIG_MEMHOLE
-       reserve_bootmem(CONFIG_MEMHOLE_START, CONFIG_MEMHOLE_SIZE);
+       reserve_bootmem(CONFIG_MEMHOLE_START, CONFIG_MEMHOLE_SIZE,
+                       BOOTMEM_DEFAULT);
 #endif
 
 #ifdef CONFIG_BLK_DEV_INITRD
        if (LOADER_TYPE && INITRD_START) {
                if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {
-                       reserve_bootmem(INITRD_START, INITRD_SIZE);
+                       reserve_bootmem(INITRD_START, INITRD_SIZE,
+                                       BOOTMEM_DEFAULT);
                        initrd_start = INITRD_START + PAGE_OFFSET;
                        initrd_end = initrd_start + INITRD_SIZE;
                        printk("initrd:start[%08lx],size[%08lx]\n",
index c7efdb0aefc5998768b0984137b035ce3f1cd7c3..07c1af7dc0e2a3bffec2474e22fab8a17fee0dce 100644 (file)
@@ -91,7 +91,8 @@ unsigned long __init setup_memory(void)
                        PFN_PHYS(mp->pages));
 
                reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(mp->start_pfn),
-                       PFN_PHYS(mp->free_pfn - mp->start_pfn) + bootmap_size);
+                       PFN_PHYS(mp->free_pfn - mp->start_pfn) + bootmap_size,
+                       BOOTMEM_DEFAULT);
 
                if (max_low_pfn < max_pfn)
                        max_low_pfn = max_pfn;
@@ -104,7 +105,7 @@ unsigned long __init setup_memory(void)
        if (LOADER_TYPE && INITRD_START) {
                if (INITRD_START + INITRD_SIZE <= PFN_PHYS(max_low_pfn)) {
                        reserve_bootmem_node(NODE_DATA(0), INITRD_START,
-                               INITRD_SIZE);
+                               INITRD_SIZE, BOOTMEM_DEFAULT);
                        initrd_start = INITRD_START + PAGE_OFFSET;
                        initrd_end = initrd_start + INITRD_SIZE;
                        printk("initrd:start[%08lx],size[%08lx]\n",
index 8dda6515887affd45d33a55981329f5125eda9ba..0055a6c06f755a9aa2ab0f10301782ecf4ab632e 100644 (file)
@@ -154,7 +154,7 @@ void __init atari_stram_reserve_pages(void *start_mem)
        /* always reserve first page of ST-RAM, the first 2 kB are
         * supervisor-only! */
        if (!kernel_in_stram)
-               reserve_bootmem (0, PAGE_SIZE);
+               reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT);
 
 }
 
index ed3a4caec6209dfc5f73b3bf4561b222801d7a6b..9a06c48edcb3c47468a0db8163d116eaaa9d032c 100644 (file)
@@ -323,7 +323,8 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_BLK_DEV_INITRD
        if (m68k_ramdisk.size) {
                reserve_bootmem_node(__virt_to_node(phys_to_virt(m68k_ramdisk.addr)),
-                                    m68k_ramdisk.addr, m68k_ramdisk.size);
+                                    m68k_ramdisk.addr, m68k_ramdisk.size,
+                                    BOOTMEM_DEFAULT);
                initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
                initrd_end = initrd_start + m68k_ramdisk.size;
                printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
index 81507c53d4a9b7cfce58de6bc0f4ee8f07bbccae..156c6c662c7e87fa3feabf82cc83c6b9c10e6e7e 100644 (file)
@@ -203,7 +203,7 @@ void __init setup_arch(char **cmdline_p)
         * the bootmem bitmap so we then reserve it after freeing it :-)
         */
        free_bootmem(memory_start, memory_end - memory_start);
-       reserve_bootmem(memory_start, bootmap_size);
+       reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
 
        /*
         * Get kmalloc into gear.
index c032409cba9b50b7df4bfad7988dd26ad0d00213..39f3dfe134fb9cb619c3c49d48de00be105a9490 100644 (file)
@@ -232,7 +232,7 @@ static void __init finalize_initrd(void)
                goto disable;
        }
 
-       reserve_bootmem(__pa(initrd_start), size);
+       reserve_bootmem(__pa(initrd_start), size, BOOTMEM_DEFAULT);
        initrd_below_start_ok = 1;
 
        printk(KERN_INFO "Initial ramdisk at: 0x%lx (%lu bytes)\n",
@@ -413,7 +413,7 @@ static void __init bootmem_init(void)
        /*
         * Reserve the bootmap memory.
         */
-       reserve_bootmem(PFN_PHYS(mapstart), bootmap_size);
+       reserve_bootmem(PFN_PHYS(mapstart), bootmap_size, BOOTMEM_DEFAULT);
 
        /*
         * Reserve initrd memory if needed.
index e5e023f50a07d3f01b74361af21038f31ab05730..bf438d02366e4823aa5849d9592b9163bfb088ae 100644 (file)
@@ -465,7 +465,8 @@ static void __init node_mem_init(cnodeid_t node)
        free_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT,
                        (slot_lastpfn - slot_firstpfn) << PAGE_SHIFT);
        reserve_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT,
-               ((slot_freepfn - slot_firstpfn) << PAGE_SHIFT) + bootmap_size);
+               ((slot_freepfn - slot_firstpfn) << PAGE_SHIFT) + bootmap_size,
+               BOOTMEM_DEFAULT);
 }
 
 /*
index aa875fa43488b8a835e2b6d079871832bc0c308f..eb80f5e33d7dad11b2cb11b9e8a2b9136c0863dc 100644 (file)
@@ -315,11 +315,13 @@ static void __init setup_bootmem(void)
 #define PDC_CONSOLE_IO_IODC_SIZE 32768
 
        reserve_bootmem_node(NODE_DATA(0), 0UL,
-                       (unsigned long)(PAGE0->mem_free + PDC_CONSOLE_IO_IODC_SIZE));
+                       (unsigned long)(PAGE0->mem_free +
+                               PDC_CONSOLE_IO_IODC_SIZE), BOOTMEM_DEFAULT);
        reserve_bootmem_node(NODE_DATA(0), __pa((unsigned long)_text),
-                       (unsigned long)(_end - _text));
+                       (unsigned long)(_end - _text), BOOTMEM_DEFAULT);
        reserve_bootmem_node(NODE_DATA(0), (bootmap_start_pfn << PAGE_SHIFT),
-                       ((bootmap_pfn - bootmap_start_pfn) << PAGE_SHIFT));
+                       ((bootmap_pfn - bootmap_start_pfn) << PAGE_SHIFT),
+                       BOOTMEM_DEFAULT);
 
 #ifndef CONFIG_DISCONTIGMEM
 
@@ -328,7 +330,8 @@ static void __init setup_bootmem(void)
        for (i = 0; i < npmem_holes; i++) {
                reserve_bootmem_node(NODE_DATA(0),
                                (pmem_holes[i].start_pfn << PAGE_SHIFT),
-                               (pmem_holes[i].pages << PAGE_SHIFT));
+                               (pmem_holes[i].pages << PAGE_SHIFT),
+                               BOOTMEM_DEFAULT);
        }
 #endif
 
@@ -346,7 +349,8 @@ static void __init setup_bootmem(void)
                        initrd_below_start_ok = 1;
                        printk(KERN_INFO "initrd: reserving %08lx-%08lx (mem_max %08lx)\n", __pa(initrd_start), __pa(initrd_start) + initrd_reserve, mem_max);
 
-                       reserve_bootmem_node(NODE_DATA(0),__pa(initrd_start), initrd_reserve);
+                       reserve_bootmem_node(NODE_DATA(0), __pa(initrd_start),
+                                       initrd_reserve, BOOTMEM_DEFAULT);
                }
        }
 #endif
index e8122447f019ef81b5346ab911f82bd3c4439cd6..ff5debf5eeddcef097b30b06e5ae97c5b4d4d833 100644 (file)
@@ -220,12 +220,13 @@ void __init do_init_bootmem(void)
                                     lmb_size_bytes(&lmb.reserved, i) - 1;
                if (addr < total_lowmem)
                        reserve_bootmem(lmb.reserved.region[i].base,
-                                       lmb_size_bytes(&lmb.reserved, i));
+                                       lmb_size_bytes(&lmb.reserved, i),
+                                       BOOTMEM_DEFAULT);
                else if (lmb.reserved.region[i].base < total_lowmem) {
                        unsigned long adjusted_size = total_lowmem -
                                      lmb.reserved.region[i].base;
                        reserve_bootmem(lmb.reserved.region[i].base,
-                                       adjusted_size);
+                                       adjusted_size, BOOTMEM_DEFAULT);
                }
        }
 #else
@@ -234,7 +235,8 @@ void __init do_init_bootmem(void)
        /* reserve the sections we're already using */
        for (i = 0; i < lmb.reserved.cnt; i++)
                reserve_bootmem(lmb.reserved.region[i].base,
-                               lmb_size_bytes(&lmb.reserved, i));
+                               lmb_size_bytes(&lmb.reserved, i),
+                               BOOTMEM_DEFAULT);
 
 #endif
        /* XXX need to clip this if using highmem? */
index c12adc3ddffd892b3238025873afc7764eb20831..bc60322d2436d6dca4d224db01c1d475dd394af3 100644 (file)
@@ -675,7 +675,7 @@ void __init do_init_bootmem(void)
                                dbg("reserve_bootmem %lx %lx\n", physbase,
                                    size);
                                reserve_bootmem_node(NODE_DATA(nid), physbase,
-                                                    size);
+                                                    size, BOOTMEM_DEFAULT);
                        }
                }
 
index 29ae165d174931b0d7b1775e3690c1be23d5c8f9..f9f8779022a0dc5c218b56628b00bd1c49d33c34 100644 (file)
@@ -649,21 +649,24 @@ setup_memory(void)
        /*
         * Reserve memory used for lowcore/command line/kernel image.
         */
-       reserve_bootmem(0, (unsigned long)_ehead);
+       reserve_bootmem(0, (unsigned long)_ehead, BOOTMEM_DEFAULT);
        reserve_bootmem((unsigned long)_stext,
-                       PFN_PHYS(start_pfn) - (unsigned long)_stext);
+                       PFN_PHYS(start_pfn) - (unsigned long)_stext,
+                       BOOTMEM_DEFAULT);
        /*
         * Reserve the bootmem bitmap itself as well. We do this in two
         * steps (first step was init_bootmem()) because this catches
         * the (very unlikely) case of us accidentally initializing the
         * bootmem allocator with an invalid RAM area.
         */
-       reserve_bootmem(start_pfn << PAGE_SHIFT, bootmap_size);
+       reserve_bootmem(start_pfn << PAGE_SHIFT, bootmap_size,
+                       BOOTMEM_DEFAULT);
 
 #ifdef CONFIG_BLK_DEV_INITRD
        if (INITRD_START && INITRD_SIZE) {
                if (INITRD_START + INITRD_SIZE <= memory_end) {
-                       reserve_bootmem(INITRD_START, INITRD_SIZE);
+                       reserve_bootmem(INITRD_START, INITRD_SIZE,
+                                       BOOTMEM_DEFAULT);
                        initrd_start = INITRD_START;
                        initrd_end = initrd_start + INITRD_SIZE;
                } else {
index 855cdf9d85b1867c47dde1974a818f745f6ddb85..af10db90a554113436169721d5d112595766fb05 100644 (file)
@@ -148,7 +148,8 @@ static void __init reserve_crashkernel(void)
                                        (unsigned long)(free_mem >> 20));
                        crashk_res.start = crash_base;
                        crashk_res.end   = crash_base + crash_size - 1;
-                       reserve_bootmem(crash_base, crash_size);
+                       reserve_bootmem(crash_base, crash_size,
+                                       BOOTMEM_DEFAULT);
                } else
                        printk(KERN_INFO "crashkernel reservation failed - "
                                        "you have to specify a base address\n");
@@ -184,13 +185,14 @@ void __init setup_bootmem_allocator(unsigned long free_pfn)
         * an invalid RAM area.
         */
        reserve_bootmem(__MEMORY_START+PAGE_SIZE,
-               (PFN_PHYS(free_pfn)+bootmap_size+PAGE_SIZE-1)-__MEMORY_START);
+               (PFN_PHYS(free_pfn)+bootmap_size+PAGE_SIZE-1)-__MEMORY_START,
+               BOOTMEM_DEFAULT);
 
        /*
         * reserve physical page 0 - it's a special BIOS page on many boxes,
         * enabling clean reboots, SMP operation, laptop functions.
         */
-       reserve_bootmem(__MEMORY_START, PAGE_SIZE);
+       reserve_bootmem(__MEMORY_START, PAGE_SIZE, BOOTMEM_DEFAULT);
 
        sparse_memory_present_with_active_regions(0);
 
@@ -200,7 +202,7 @@ void __init setup_bootmem_allocator(unsigned long free_pfn)
        if (LOADER_TYPE && INITRD_START) {
                if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {
                        reserve_bootmem(INITRD_START + __MEMORY_START,
-                                       INITRD_SIZE);
+                                       INITRD_SIZE, BOOTMEM_DEFAULT);
                        initrd_start = INITRD_START + PAGE_OFFSET +
                                        __MEMORY_START;
                        initrd_end = initrd_start + INITRD_SIZE;
index 8aff065dd30714c842a5cbf828d7eb71e5d28355..2de7302724fc188cd6a8bf9680470bc55fad2dc7 100644 (file)
@@ -80,9 +80,9 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
 
        /* Reserve the pgdat and bootmap space with the bootmem allocator */
        reserve_bootmem_node(NODE_DATA(nid), start_pfn << PAGE_SHIFT,
-                            sizeof(struct pglist_data));
+                            sizeof(struct pglist_data), BOOTMEM_DEFAULT);
        reserve_bootmem_node(NODE_DATA(nid), free_pfn << PAGE_SHIFT,
-                            bootmap_pages << PAGE_SHIFT);
+                            bootmap_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
 
        /* It's up */
        node_set_online(nid);
index a1bef07755a920076d186880269af56f5f9348db..b89837accc88574e9554706ab1084e8fd642250a 100644 (file)
@@ -259,7 +259,7 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
        if (initrd_start) {
                /* Reserve the initrd image area. */
                size = initrd_end - initrd_start;
-               reserve_bootmem(initrd_start, size);
+               reserve_bootmem(initrd_start, size, BOOTMEM_DEFAULT);
                *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT;
 
                initrd_start = (initrd_start - phys_base) + PAGE_OFFSET;
@@ -268,7 +268,7 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
 #endif
        /* Reserve the kernel text/data/bss. */
        size = (start_pfn << PAGE_SHIFT) - phys_base;
-       reserve_bootmem(phys_base, size);
+       reserve_bootmem(phys_base, size, BOOTMEM_DEFAULT);
        *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT;
 
        /* Reserve the bootmem map.   We do not account for it
@@ -276,7 +276,7 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
         * in free_all_bootmem.
         */
        size = bootmap_size;
-       reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size);
+       reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size, BOOTMEM_DEFAULT);
        *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT;
 
        return max_pfn;
index 523e993ee90ca3b46652376a2b3e792b1b462f7d..e726c45645ff3bc85df870d7eed4613427062133 100644 (file)
@@ -997,7 +997,7 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
                prom_printf("reserve_bootmem(initrd): base[%llx] size[%lx]\n",
                        initrd_start, initrd_end);
 #endif
-               reserve_bootmem(initrd_start, size);
+               reserve_bootmem(initrd_start, size, BOOTMEM_DEFAULT);
 
                initrd_start += PAGE_OFFSET;
                initrd_end += PAGE_OFFSET;
@@ -1007,7 +1007,7 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
 #ifdef CONFIG_DEBUG_BOOTMEM
        prom_printf("reserve_bootmem(kernel): base[%lx] size[%lx]\n", kern_base, kern_size);
 #endif
-       reserve_bootmem(kern_base, kern_size);
+       reserve_bootmem(kern_base, kern_size, BOOTMEM_DEFAULT);
        *pages_avail -= PAGE_ALIGN(kern_size) >> PAGE_SHIFT;
 
        /* Add back in the initmem pages. */
@@ -1024,7 +1024,7 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
        prom_printf("reserve_bootmem(bootmap): base[%lx] size[%lx]\n",
                    (bootmap_pfn << PAGE_SHIFT), size);
 #endif
-       reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size);
+       reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size, BOOTMEM_DEFAULT);
 
        for (i = 0; i < pavail_ents; i++) {
                unsigned long start_pfn, end_pfn;
@@ -1489,7 +1489,7 @@ static void __init taint_real_pages(void)
                                        goto do_next_page;
                                }
                        }
-                       reserve_bootmem(old_start, PAGE_SIZE);
+                       reserve_bootmem(old_start, PAGE_SIZE, BOOTMEM_DEFAULT);
 
                do_next_page:
                        old_start += PAGE_SIZE;
index 0e429041a117606aa39674aa3d367ac684910a92..5978a25170fb44aa7986be9202abe7527f39787b 100644 (file)
@@ -85,7 +85,8 @@ void __init mach_reserve_bootmem ()
        /* The space between SRAM and SDRAM is filled with duplicate
           images of SRAM.  Prevent the kernel from using them.  */
        reserve_bootmem (SRAM_ADDR + SRAM_SIZE,
-                        SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE));
+                        SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE),
+                        BOOTMEM_DEFAULT);
 }
 
 void mach_gettimeofday (struct timespec *tv)
index 18437bc5c3ad29aa53eb221d0a1595aa7445aac2..b525ecf3aea49c4cd6707f2a8c53e447caf81693 100644 (file)
@@ -116,7 +116,8 @@ void __init mach_reserve_bootmem ()
        if (SDRAM_ADDR < RAM_END && SDRAM_ADDR > RAM_START)
                /* We can't use the space between SRAM and SDRAM, so
                   prevent the kernel from trying.  */
-               reserve_bootmem (SRAM_END, SDRAM_ADDR - SRAM_END);
+               reserve_bootmem(SRAM_END, SDRAM_ADDR - SRAM_END,
+                               BOOTMEM_DEFAULT);
 }
 
 void mach_gettimeofday (struct timespec *tv)
index 9a716f9464218ba269495cd33638930de0d29174..08abf3d5f8df1c33d84bcef6bf1719e4da9358df 100644 (file)
@@ -46,13 +46,15 @@ void __init mach_reserve_bootmem ()
 {
 #ifdef CONFIG_RTE_CB_MULTI
        /* Prevent the kernel from touching the monitor's scratch RAM.  */
-       reserve_bootmem (MON_SCRATCH_ADDR, MON_SCRATCH_SIZE);
+       reserve_bootmem(MON_SCRATCH_ADDR, MON_SCRATCH_SIZE,
+                       BOOTMEM_DEFAULT);
 #endif
 
        /* The space between SRAM and SDRAM is filled with duplicate
           images of SRAM.  Prevent the kernel from using them.  */
        reserve_bootmem (SRAM_ADDR + SRAM_SIZE,
-                        SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE));
+                        SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE),
+                        BOOTMEM_DEFAULT);
 }
 
 void mach_gettimeofday (struct timespec *tv)
index a914f244f494a77c0d7654e4e8473c7e1e06ea24..a0a8456a8430d6349deee2883ad5646ae65a0f70 100644 (file)
@@ -241,15 +241,18 @@ init_bootmem_alloc (unsigned long ram_start, unsigned long ram_len)
        if (kram_end > kram_start)
                /* Reserve the RAM part of the kernel's address space, so it
                   doesn't get allocated.  */
-               reserve_bootmem (kram_start, kram_end - kram_start);
+               reserve_bootmem(kram_start, kram_end - kram_start,
+                               BOOTMEM_DEFAULT);
        
        if (intv_in_ram && !intv_in_kram)
                /* Reserve the interrupt vector space.  */
-               reserve_bootmem (intv_start, intv_end - intv_start);
+               reserve_bootmem(intv_start, intv_end - intv_start,
+                               BOOTMEM_DEFAULT);
 
        if (bootmap >= ram_start && bootmap < ram_end)
                /* Reserve the bootmap space.  */
-               reserve_bootmem (bootmap, bootmap_len);
+               reserve_bootmem(bootmap, bootmap_len,
+                               BOOTMEM_DEFAULT);
 
        /* Reserve the memory used by the root filesystem image if it's
           in RAM.  */
@@ -257,7 +260,8 @@ init_bootmem_alloc (unsigned long ram_start, unsigned long ram_len)
            && (unsigned long)&_root_fs_image_start >= ram_start
            && (unsigned long)&_root_fs_image_start < ram_end)
                reserve_bootmem ((unsigned long)&_root_fs_image_start,
-                                &_root_fs_image_end - &_root_fs_image_start);
+                                &_root_fs_image_end - &_root_fs_image_start,
+                                BOOTMEM_DEFAULT);
 
        /* Let the platform-dependent code reserve some too.  */
        if (mrb)
index 67009cdd5eca194bbf60fb9a7209a1b94550c23b..f349e68e45a0207793432ec794fea8aa441f6f77 100644 (file)
@@ -736,7 +736,8 @@ static int __init smp_scan_config (unsigned long base, unsigned long length)
                        smp_found_config = 1;
                        printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n",
                                mpf, virt_to_phys(mpf));
-                       reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE);
+                       reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE,
+                                       BOOTMEM_DEFAULT);
                        if (mpf->mpf_physptr) {
                                /*
                                 * We cannot access to MPC table to compute
@@ -751,7 +752,8 @@ static int __init smp_scan_config (unsigned long base, unsigned long length)
                                unsigned long end = max_low_pfn * PAGE_SIZE;
                                if (mpf->mpf_physptr + size > end)
                                        size = end - mpf->mpf_physptr;
-                               reserve_bootmem(mpf->mpf_physptr, size);
+                               reserve_bootmem(mpf->mpf_physptr, size,
+                                               BOOTMEM_DEFAULT);
                        }
 
                        mpf_found = mpf;
index 62adc5f20be5bf87cce61b42c17f5aebf367bdd6..d1d8c347cc0b77a05f2c7d90ca1ddaa1d5420e99 100644 (file)
@@ -390,7 +390,7 @@ static void __init reserve_ebda_region(void)
        unsigned int addr;
        addr = get_bios_ebda();
        if (addr)
-               reserve_bootmem(addr, PAGE_SIZE);
+               reserve_bootmem(addr, PAGE_SIZE, BOOTMEM_DEFAULT);
 }
 
 #ifndef CONFIG_NEED_MULTIPLE_NODES
@@ -484,7 +484,8 @@ static void __init reserve_crashkernel(void)
                                        (unsigned long)(total_mem >> 20));
                        crashk_res.start = crash_base;
                        crashk_res.end   = crash_base + crash_size - 1;
-                       reserve_bootmem(crash_base, crash_size);
+                       reserve_bootmem(crash_base, crash_size,
+                                       BOOTMEM_DEFAULT);
                } else
                        printk(KERN_INFO "crashkernel reservation failed - "
                                        "you have to specify a base address\n");
@@ -525,7 +526,7 @@ static void __init reserve_initrd(void)
        }
        if (ramdisk_end <= end_of_lowmem) {
                /* All in lowmem, easy case */
-               reserve_bootmem(ramdisk_image, ramdisk_size);
+               reserve_bootmem(ramdisk_image, ramdisk_size, BOOTMEM_DEFAULT);
                initrd_start = ramdisk_image + PAGE_OFFSET;
                initrd_end = initrd_start+ramdisk_size;
                return;
@@ -536,7 +537,7 @@ static void __init reserve_initrd(void)
 
        /* Note: this includes all the lowmem currently occupied by
           the initrd, we rely on that fact to keep the data intact. */
-       reserve_bootmem(ramdisk_here, ramdisk_size);
+       reserve_bootmem(ramdisk_here, ramdisk_size, BOOTMEM_DEFAULT);
        initrd_start = ramdisk_here + PAGE_OFFSET;
        initrd_end   = initrd_start + ramdisk_size;
 
@@ -606,13 +607,14 @@ void __init setup_bootmem_allocator(void)
         * bootmem allocator with an invalid RAM area.
         */
        reserve_bootmem(__pa_symbol(_text), (PFN_PHYS(min_low_pfn) +
-                        bootmap_size + PAGE_SIZE-1) - __pa_symbol(_text));
+                        bootmap_size + PAGE_SIZE-1) - __pa_symbol(_text),
+                        BOOTMEM_DEFAULT);
 
        /*
         * reserve physical page 0 - it's a special BIOS page on many boxes,
         * enabling clean reboots, SMP operation, laptop functions.
         */
-       reserve_bootmem(0, PAGE_SIZE);
+       reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT);
 
        /* reserve EBDA region, it's a 4K region */
        reserve_ebda_region();
@@ -622,7 +624,7 @@ void __init setup_bootmem_allocator(void)
        unless you have no PS/2 mouse plugged in. */
        if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
            boot_cpu_data.x86 == 6)
-            reserve_bootmem(0xa0000 - 4096, 4096);
+            reserve_bootmem(0xa0000 - 4096, 4096, BOOTMEM_DEFAULT);
 
 #ifdef CONFIG_SMP
        /*
@@ -630,7 +632,7 @@ void __init setup_bootmem_allocator(void)
         * FIXME: Don't need the extra page at 4K, but need to fix
         * trampoline before removing it. (see the GDT stuff)
         */
-       reserve_bootmem(PAGE_SIZE, PAGE_SIZE);
+       reserve_bootmem(PAGE_SIZE, PAGE_SIZE, BOOTMEM_DEFAULT);
 #endif
 #ifdef CONFIG_ACPI_SLEEP
        /*
index c8939dfddfba3c0f7bdd63e3d21d6d38e67712fc..8345c3b12f0590e1d20fde4d0f8c3f49a5f7250b 100644 (file)
@@ -189,7 +189,7 @@ contig_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
        bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, end_pfn);
        e820_register_active_regions(0, start_pfn, end_pfn);
        free_bootmem_with_active_regions(0, end_pfn);
-       reserve_bootmem(bootmap, bootmap_size);
+       reserve_bootmem(bootmap, bootmap_size, BOOTMEM_DEFAULT);
 }
 #endif
 
@@ -238,7 +238,8 @@ static void __init reserve_crashkernel(void)
                                        (unsigned long)(free_mem >> 20));
                        crashk_res.start = crash_base;
                        crashk_res.end   = crash_base + crash_size - 1;
-                       reserve_bootmem(crash_base, crash_size);
+                       reserve_bootmem(crash_base, crash_size,
+                                       BOOTMEM_DEFAULT);
                } else
                        printk(KERN_INFO "crashkernel reservation failed - "
                                        "you have to specify a base address\n");
index 04b1d20e2613ca16018424a10e037f68cfa36973..c394ca0720b8d0566f39536b57fc241202c5eb7a 100644 (file)
@@ -391,7 +391,8 @@ unsigned long __init setup_memory(void)
 void __init numa_kva_reserve(void)
 {
        if (kva_pages)
-               reserve_bootmem(PFN_PHYS(kva_start_pfn), PFN_PHYS(kva_pages));
+               reserve_bootmem(PFN_PHYS(kva_start_pfn), PFN_PHYS(kva_pages),
+                               BOOTMEM_DEFAULT);
 }
 
 void __init zone_sizes_init(void)
index 9b61c75a23556f76898ca2f8b1d26d71b206ca26..5fe880fc305d03c90131948bab8c4cd16096e9f9 100644 (file)
@@ -644,9 +644,9 @@ void __init reserve_bootmem_generic(unsigned long phys, unsigned len)
 
        /* Should check here against the e820 map to avoid double free */
 #ifdef CONFIG_NUMA
-       reserve_bootmem_node(NODE_DATA(nid), phys, len);
+       reserve_bootmem_node(NODE_DATA(nid), phys, len, BOOTMEM_DEFAULT);
 #else
-       reserve_bootmem(phys, len);
+       reserve_bootmem(phys, len, BOOTMEM_DEFAULT);
 #endif
        if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) {
                dma_reserve += len / PAGE_SIZE;
index 5a02bf4c91ec7eac8b9c25da1cf1f666bc2b961f..1aecc658cd7d9f5f89812196cedfe6721229db88 100644 (file)
@@ -238,9 +238,10 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
 
        free_bootmem_with_active_regions(nodeid, end);
 
-       reserve_bootmem_node(NODE_DATA(nodeid), nodedata_phys, pgdat_size);
+       reserve_bootmem_node(NODE_DATA(nodeid), nodedata_phys, pgdat_size,
+                       BOOTMEM_DEFAULT);
        reserve_bootmem_node(NODE_DATA(nodeid), bootmap_start,
-                            bootmap_pages<<PAGE_SHIFT);
+                       bootmap_pages<<PAGE_SHIFT, BOOTMEM_DEFAULT);
 #ifdef CONFIG_ACPI_NUMA
        srat_reserve_add_area(nodeid);
 #endif
index 65416f843e597b2908d64eee5ae321f1e29d7537..ecd91ea8a8ae66d5f7ecd54de0b907fc65565bd4 100644 (file)
@@ -488,7 +488,8 @@ void __init srat_reserve_add_area(int nodeid)
                printk(KERN_INFO "SRAT: This will cost you %Lu MB of "
                                "pre-allocated memory.\n", (unsigned long long)total_mb);
                reserve_bootmem_node(NODE_DATA(nodeid), nodes_add[nodeid].start,
-                              nodes_add[nodeid].end - nodes_add[nodeid].start);
+                              nodes_add[nodeid].end - nodes_add[nodeid].start,
+                              BOOTMEM_DEFAULT);
        }
 }
 
index 5d6f4ce6e6d64b9fe7dce596f67e4b1165147e77..274a59566c45089d606e323262a08773883bb521 100644 (file)
@@ -107,8 +107,8 @@ static inline int pfn_valid(int pfn)
 /*
  * Following are macros that are specific to this numa platform.
  */
-#define reserve_bootmem(addr, size) \
-       reserve_bootmem_node(NODE_DATA(0), (addr), (size))
+#define reserve_bootmem(addr, size, flags) \
+       reserve_bootmem_node(NODE_DATA(0), (addr), (size), (flags))
 #define alloc_bootmem(x) \
        __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
 #define alloc_bootmem_low(x) \
index 0365ec9fc0c9248422801fe71b232d1188a12972..4e4e340592fb08b26cb1c3c5cd7c14d7a9ff9bc9 100644 (file)
@@ -60,8 +60,20 @@ extern void *__alloc_bootmem_core(struct bootmem_data *bdata,
                                  unsigned long goal,
                                  unsigned long limit);
 
+/*
+ * flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE,
+ * the architecture-specific code should honor this)
+ */
+#define BOOTMEM_DEFAULT                0
+#define BOOTMEM_EXCLUSIVE      (1<<0)
+
 #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
-extern void reserve_bootmem(unsigned long addr, unsigned long size);
+/*
+ * If flags is 0, then the return value is always 0 (success). If
+ * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the
+ * memory already was reserved.
+ */
+extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags);
 #define alloc_bootmem(x) \
        __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
 #define alloc_bootmem_low(x) \
@@ -84,7 +96,8 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
                                       unsigned long endpfn);
 extern void reserve_bootmem_node(pg_data_t *pgdat,
                                 unsigned long physaddr,
-                                unsigned long size);
+                                unsigned long size,
+                                int flags);
 extern void free_bootmem_node(pg_data_t *pgdat,
                              unsigned long addr,
                              unsigned long size);
index 00a96970b237efe9a62c8c6cd8859ef625868bc1..f6ff4337b4242e911ab4e4faadb160b76a445b50 100644 (file)
@@ -111,11 +111,12 @@ static unsigned long __init init_bootmem_core(pg_data_t *pgdat,
  * might be used for boot-time allocations - or it might get added
  * to the free page pool later on.
  */
-static void __init reserve_bootmem_core(bootmem_data_t *bdata, unsigned long addr,
-                                       unsigned long size)
+static int __init reserve_bootmem_core(bootmem_data_t *bdata,
+                       unsigned long addr, unsigned long size, int flags)
 {
        unsigned long sidx, eidx;
        unsigned long i;
+       int ret;
 
        /*
         * round up, partially reserved pages are considered
@@ -133,7 +134,20 @@ static void __init reserve_bootmem_core(bootmem_data_t *bdata, unsigned long add
 #ifdef CONFIG_DEBUG_BOOTMEM
                        printk("hm, page %08lx reserved twice.\n", i*PAGE_SIZE);
 #endif
+                       if (flags & BOOTMEM_EXCLUSIVE) {
+                               ret = -EBUSY;
+                               goto err;
+                       }
                }
+
+       return 0;
+
+err:
+       /* unreserve memory we accidentally reserved */
+       for (i--; i >= sidx; i--)
+               clear_bit(i, bdata->node_bootmem_map);
+
+       return ret;
 }
 
 static 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,
 }
 
 void __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
-                                unsigned long size)
+                                unsigned long size, int flags)
 {
-       reserve_bootmem_core(pgdat->bdata, physaddr, size);
+       reserve_bootmem_core(pgdat->bdata, physaddr, size, flags);
 }
 
 void __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)
 }
 
 #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
-void __init reserve_bootmem(unsigned long addr, unsigned long size)
+int __init reserve_bootmem(unsigned long addr, unsigned long size,
+                           int flags)
 {
-       reserve_bootmem_core(NODE_DATA(0)->bdata, addr, size);
+       return reserve_bootmem_core(NODE_DATA(0)->bdata, addr, size, flags);
 }
 #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */