Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 173054
b: refs/heads/master
c: 4428073
h: refs/heads/master
v: v3
  • Loading branch information
Yinghai Lu authored and Ingo Molnar committed Nov 23, 2009
1 parent 82f3312 commit 9dbd0de
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 43 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 350f8f5631922c7848ec4b530c111cb8c2ff7caa
refs/heads/master: 44280733e71ad15377735b42d8538c109c94d7e3
57 changes: 15 additions & 42 deletions trunk/arch/x86/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,42 +487,11 @@ static void __init reserve_early_setup_data(void)

#ifdef CONFIG_KEXEC

/**
* Reserve @size bytes of crashkernel memory at any suitable offset.
*
* @size: Size of the crashkernel memory to reserve.
* Returns the base address on success, and -1ULL on failure.
*/
static
unsigned long long __init find_and_reserve_crashkernel(unsigned long long size)
{
const unsigned long long alignment = 16<<20; /* 16M */
unsigned long long start = 0LL;

while (1) {
int ret;

start = find_e820_area(start, ULONG_MAX, size, alignment);
if (start == -1ULL)
return start;

/* try to reserve it */
ret = reserve_bootmem_generic(start, size, BOOTMEM_EXCLUSIVE);
if (ret >= 0)
return start;

start += alignment;
}
}

static inline unsigned long long get_total_mem(void)
{
unsigned long long total;

total = max_low_pfn - min_low_pfn;
#ifdef CONFIG_HIGHMEM
total += highend_pfn - highstart_pfn;
#endif
total = max_pfn - min_low_pfn;

return total << PAGE_SHIFT;
}
Expand All @@ -542,21 +511,25 @@ static void __init reserve_crashkernel(void)

/* 0 means: find the address automatically */
if (crash_base <= 0) {
crash_base = find_and_reserve_crashkernel(crash_size);
const unsigned long long alignment = 16<<20; /* 16M */

crash_base = find_e820_area(alignment, ULONG_MAX, crash_size,
alignment);
if (crash_base == -1ULL) {
pr_info("crashkernel reservation failed. "
"No suitable area found.\n");
pr_info("crashkernel reservation failed - No suitable area found.\n");
return;
}
} else {
ret = reserve_bootmem_generic(crash_base, crash_size,
BOOTMEM_EXCLUSIVE);
if (ret < 0) {
pr_info("crashkernel reservation failed - "
"memory is in use\n");
unsigned long long start;

start = find_e820_area(crash_base, ULONG_MAX, crash_size,
1<<20);
if (start != crash_base) {
pr_info("crashkernel reservation failed - memory is in use.\n");
return;
}
}
reserve_early(crash_base, crash_base + crash_size, "CRASH KERNEL");

printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
"for crashkernel (System RAM: %ldMB)\n",
Expand Down Expand Up @@ -927,6 +900,8 @@ void __init setup_arch(char **cmdline_p)

reserve_initrd();

reserve_crashkernel();

vsmp_init();

io_delay_init();
Expand Down Expand Up @@ -957,8 +932,6 @@ void __init setup_arch(char **cmdline_p)
*/
find_smp_config();

reserve_crashkernel();

#ifdef CONFIG_X86_64
/*
* dma32_reserve_bootmem() allocates bootmem which may conflict
Expand Down

0 comments on commit 9dbd0de

Please sign in to comment.