[PATCH v3 15/17] crash: Simplify CRASH_MAX_MEMORY_RANGES handling
Jinjie Ruan <[email protected]>
| Newsgroups | dev.linux.lists.loongarch,org.infradead.lists.kexec,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kvack.linux-mm,org.ozlabs.lists.linuxppc-dev |
|---|---|
| Message-ID | <[email protected]> |
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]> --- arch/powerpc/kexec/crash.c | 4 +--- arch/x86/kernel/crash.c | 4 +--- kernel/Kconfig.kexec | 3 ++- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kexec/crash.c b/arch/powerpc/kexec/crash.c index fc0105c7af4c..c47e3f867ea1 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 99eb8583d932..116410ac90fb 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 a97ed9605602..e6251dfe451a 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 depends on CRASH_HOTPLUG help For the kexec_file_load() syscall path, specify the maximum number of -- 2.34.1