From 73929fc549f4038dcee0a57f6089cc2b0ab32a9c Mon Sep 17 00:00:00 2001 From: Pingfan Liu Date: Tue, 25 May 2021 10:36:01 +0800 Subject: [PATCH] kdump-lib.sh: fix the case if no enough total RAM for kdump in get_recommend_size() Resolves: bz1952342 Upstream: Fedora Conflict: None commit 45377836b014e22c27e5a210e679501f97ba4525 Author: Pingfan Liu Date: Tue May 25 09:26:09 2021 +0800 kdump-lib.sh: fix the case if no enough total RAM for kdump in get_recommend_size() For crashkernel=auto policy, if total RAM size is under a throttle, there is no memory reserved for kdump. Also correct a trivial bug by correcting the arch name. Signed-off-by: Pingfan Liu Acked-by: Kairui Song Signed-off-by: Pingfan Liu --- kdump-lib.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kdump-lib.sh b/kdump-lib.sh index 88fea64..9b90643 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -894,6 +894,11 @@ get_recommend_size() last_sz="" last_unit="" + start=${_ck_cmdline: :1} + if [ $mem_size -lt $start ]; then + echo "0M" + return + fi IFS=',' for i in $_ck_cmdline; do end=$(echo $i | awk -F "-" '{ print $2 }' | awk -F ":" '{ print $1 }') @@ -921,9 +926,9 @@ kdump_get_arch_recommend_size() fi arch=$(lscpu | grep Architecture | awk -F ":" '{ print $2 }' | tr [:lower:] [:upper:]) - if [ $arch == "X86_64" ] || [ $arch == "S390" ]; then + if [ $arch == "X86_64" ] || [ $arch == "S390X" ]; then ck_cmdline="1G-4G:160M,4G-64G:192M,64G-1T:256M,1T-:512M" - elif [ $arch == "ARM64" ]; then + elif [ $arch == "AARCH64" ]; then ck_cmdline="2G-:448M" elif [ $arch == "PPC64LE" ]; then if is_fadump_capable; then