diff options
author | Bernhard Walle <bwalle@suse.de> | 2008-02-07 03:15:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 11:42:25 -0500 |
commit | 72a7fe3967dbf86cb34e24fbf1d957fe24d2f246 (patch) | |
tree | c19f7d0b530577359840e959cce204939caf0649 /arch/sh/kernel | |
parent | 25fad945a7f7ff2cf06e437381c6a1121784dbd9 (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/kernel')
-rw-r--r-- | arch/sh/kernel/setup.c | 10 |
1 files changed, 6 insertions, 4 deletions
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; |