Hi, > Set CRASH_MAX_MEMORY_RANGES to 0 when MEMORY_HOTPLUG is disabled, then > remove the now unnecessary IS_ENABLED(CONFIG_MEMORY_HOTPLUG) checks in > powerpc and x86 arch_crash_get_elfcorehdr_size(). > > No functional change intended. > > Signed-off-by: Jinjie Ruan <[email protected]> > > diff --git a/arch/powerpc/kexec/crash.c b/arch/powerpc/kexec/crash.c > index fc0105c7af4c3..c47e3f867ea1f 100644 > --- a/arch/powerpc/kexec/crash.c > +++ b/arch/powerpc/kexec/crash.c > @@ -474,9 +474,7 @@ unsigned int arch_crash_get_elfcorehdr_size(void) > unsigned long phdr_cnt; > > /* A program header for possible CPUs + vmcoreinfo */ > - phdr_cnt = num_possible_cpus() + 1; > - if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) > - phdr_cnt += CONFIG_CRASH_MAX_MEMORY_RANGES; > + phdr_cnt = num_possible_cpus() + 1 + CONFIG_CRASH_MAX_MEMORY_RANGES; > > return elf64_phdr_size(phdr_cnt); > } > diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c > index 99eb8583d9321..116410ac90fb4 100644 > --- a/arch/x86/kernel/crash.c > +++ b/arch/x86/kernel/crash.c > @@ -407,9 +407,7 @@ unsigned int arch_crash_get_elfcorehdr_size(void) > unsigned int sz; > > /* kernel_map, VMCOREINFO and maximum CPUs */ > - sz = 2 + num_possible_cpus(); > - if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) > - sz += CONFIG_CRASH_MAX_MEMORY_RANGES; > + sz = 2 + num_possible_cpus() + CONFIG_CRASH_MAX_MEMORY_RANGES; > sz *= sizeof(Elf64_Phdr); > return sz; > } > diff --git a/kernel/Kconfig.kexec b/kernel/Kconfig.kexec > index a97ed9605602f..e6251dfe451a8 100644 > --- a/kernel/Kconfig.kexec > +++ b/kernel/Kconfig.kexec > @@ -160,7 +160,8 @@ config CRASH_HOTPLUG > > config CRASH_MAX_MEMORY_RANGES > int "Specify the maximum number of memory regions for the elfcorehdr" > - default 8192 > + default 8192 if MEMORY_HOTPLUG > + default 0 if !MEMORY_HOTPLUG
This only sets the default, but a user can change the value explicitly. -- Sincerely yours, Mike.
