Thread (4 messages) 4 messages, 2 authors, 2019-09-23

Re: [PATCH] powerpc/crashkernel: take mem option into account

From: Pingfan Liu <hidden>
Date: 2019-09-17 05:34:16
Also in: kexec

Cc Kexec list. And keep the original content.

On Thu, Sep 12, 2019 at 10:50 AM Pingfan Liu [off-list ref] wrote:
quoted hunk ↗ jump to hunk
'mem=" option is an easy way to put high pressure on memory during some
test. Hence in stead of total mem, the effective usable memory size should
be considered when reserving mem for crashkernel. Otherwise the boot up may
experience oom issue.

E.g passing
crashkernel="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G", and
mem=5G on a 256G machine.

Signed-off-by: Pingfan Liu <redacted>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
To: linuxppc-dev@lists.ozlabs.org
---
v1 -> v2: fix the printk info about the total mem
 arch/powerpc/kernel/machine_kexec.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index c4ed328..eec96dc 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -114,11 +114,12 @@ void machine_kexec(struct kimage *image)

 void __init reserve_crashkernel(void)
 {
-       unsigned long long crash_size, crash_base;
+       unsigned long long crash_size, crash_base, total_mem_sz;
        int ret;

+       total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size();
        /* use common parsing */
-       ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
+       ret = parse_crashkernel(boot_command_line, total_mem_sz,
                        &crash_size, &crash_base);
        if (ret == 0 && crash_size > 0) {
                crashk_res.start = crash_base;
@@ -185,7 +186,7 @@ void __init reserve_crashkernel(void)
                        "for crashkernel (System RAM: %ldMB)\n",
                        (unsigned long)(crash_size >> 20),
                        (unsigned long)(crashk_res.start >> 20),
-                       (unsigned long)(memblock_phys_mem_size() >> 20));
+                       (unsigned long)(total_mem_sz >> 20));

        if (!memblock_is_region_memory(crashk_res.start, crash_size) ||
            memblock_reserve(crashk_res.start, crash_size)) {
--
2.7.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help