Skip to content

Commit a5b6e57

Browse files
author
Pingfan Liu
committed
crashkernel: Maximize the reserved size in osbuild case
At present, the deduction of the proper crashkernel value depends on detecting platform details. However, more and more platforms are now deployed using OSTree images, which means kdump-utils cannot retrieve complete platform information. This often leads to an underestimation of the memory required by the kdump kernel, increasing the risk of out-of-memory (OOM) issues. To mitigate this situation, we choose to maximize the reserved crashkernel size in the osbuild case, and recommend users to update the kernel command line and release the excess reserved memory after reboot (addressed in the next patch). Signed-off-by: Pingfan Liu <[email protected]>
1 parent dfdaf14 commit a5b6e57

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

kdump-lib.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump/registered"
1616
FADUMP_APPEND_ARGS_SYS_NODE="/sys/kernel/fadump/bootargs_append"
1717
# shellcheck disable=SC2034
1818
FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
19+
maximize_crashkernel=false
1920

2021
# read the value of an environ variable from given environ file path
2122
#
@@ -65,7 +66,7 @@ is_aws_aarch64()
6566

6667
is_sme_or_sev_active()
6768
{
68-
journalctl -q --dmesg --grep "^Memory Encryption Features active: AMD (SME|SEV)$" > /dev/null 2>&1
69+
$maximize_crashkernel || journalctl -q --dmesg --grep "^Memory Encryption Features active: AMD (SME|SEV)$" > /dev/null 2>&1
6970
}
7071

7172
has_command()
@@ -873,12 +874,18 @@ get_recommend_size()
873874
874875
has_mlx5()
875876
{
876-
[[ -d /sys/bus/pci/drivers/mlx5_core ]]
877+
$maximize_crashkernel || [[ -d /sys/bus/pci/drivers/mlx5_core ]]
877878
}
878879
879880
has_aarch64_smmu()
880881
{
881-
ls /sys/devices/platform/arm-smmu-* 1> /dev/null 2>&1
882+
$maximize_crashkernel || ls /sys/devices/platform/arm-smmu-* 1> /dev/null 2>&1
883+
}
884+
885+
is_aarch64_64k_kernel()
886+
{
887+
local _kernel="$1"
888+
$maximize_crashkernel || echo "$_kernel" | grep -q 64k
882889
}
883890
884891
is_memsize()
@@ -1034,6 +1041,9 @@ kdump_get_arch_recommend_crashkernel()
10341041
local _delta=0
10351042
local _skip=0
10361043
1044+
# osbuild deploys rpm on isolated environment. kdump-utils has no opportunity
1045+
# to deduce the exact memory cost on the real target.
1046+
_is_osbuild && maximize_crashkernel=true
10371047
if [[ -z $1 ]]; then
10381048
if is_fadump_capable; then
10391049
_dump_mode=fadump
@@ -1063,7 +1073,7 @@ kdump_get_arch_recommend_crashkernel()
10631073
_skip=1
10641074
10651075
# the naming convention of 64k variant suffixes with +64k, e.g. "vmlinuz-5.14.0-312.el9.aarch64+64k"
1066-
if echo "$_running_kernel" | grep -q 64k; then
1076+
if is_aarch64_64k_kernel "$_running_kernel"; then
10671077
# Without smmu, the diff of MemFree between 4K and 64K measured on a high end aarch64 machine is 82M.
10681078
# Picking up 100M to cover this diff. And finally, we have "2G-4G:356M;4G-64G:420M;64G-:676M"
10691079
((_delta += 100))

0 commit comments

Comments
 (0)