aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
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 /arch/sh
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 'arch/sh')
-rw-r--r--arch/sh/kernel/setup.c10
-rw-r--r--arch/sh/mm/numa.c4
2 files changed, 8 insertions, 6 deletions
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 855cdf9d85b..af10db90a55 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 8aff065dd30..2de7302724f 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);