aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
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 /include/linux
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>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bootmem.h17
1 files changed, 15 insertions, 2 deletions
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);