[PATCH] x86, kdump: crashkernel=X try to reserve below 896M first, then try below 4G, then MAXMEM

Yinghai Lu yinghai at kernel.org
Thu Oct 24 15:04:04 EDT 2013


On Mon, Oct 14, 2013 at 4:46 AM, WANG Chao <chaowang at redhat.com> wrote:
> Now crashkernel=X will fail out if there's not enough memory at
> low (below 896M). What makes sense for crashkernel=X would be:
>
>  - First try to reserve X below 896M (for being compatible with old
>    kexec-tools).
>  - If fails, try to reserve X below 4G (swiotlb need to stay below 4G).
>  - If fails, try to reserve X from MAXMEM top down.
>
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index f0de629..38e6c1f 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -593,6 +593,20 @@ static void __init reserve_crashkernel(void)
>                                         high ? CRASH_KERNEL_ADDR_HIGH_MAX :
>                                                CRASH_KERNEL_ADDR_LOW_MAX,
>                                         crash_size, alignment);
> +               /*
> +                * crashkernel=X reserve below 896M fails? Try below 4G
> +                */
> +               if (!high && !crash_base)
> +                       crash_base = memblock_find_in_range(alignment,
> +                                               (1ULL << 32),
> +                                               crash_size, alignment);

Another problem, it would allocate range in [0,4g) for 32bit,
if the user have crashkernel=512M or plus.

> +               /*
> +                * crashkernel=X reserve below 4G fails? Try MAXMEM
> +                */
> +               if (!high && !crash_base)
> +                       crash_base = memblock_find_in_range(alignment,
> +                                               CRASH_KERNEL_ADDR_HIGH_MAX,
> +                                               crash_size, alignment);
>
>                 if (!crash_base) {
>                         pr_info("crashkernel reservation failed - No suitable area found.\n");


Yinghai



More information about the kexec mailing list