Skip to content

Commit fe01291

Browse files
author
Pingfan Liu
committed
kdump-lib: Extend _crashkernel_add() with a param
Currently, crashkernel_add() adjusts each range in the 'crashkernel=' command line by adding a delta value. This adjustment is necessary because certain hardware features require significant additional memory (up to 1GB on some ARM64 machines). While this approach works well for traditional installations, OSTree deployments present a challenge: kdump cannot detect the hardware environment on the target platform. One solution is to maximize the memory reserved for the kdump kernel. However, while this increased allocation ensures kdump functionality, it raises the risk of OOM conditions in the production kernel, particularly on small-memory machines that typically lack such hardware features (Mellanox network cards, SMMU, SME). This patch extends crashkernel_add() with a parameter to skip the first N ranges in the 'crashkernel=' command line. Later, we can use it to skip the first range. Signed-off-by: Pingfan Liu <[email protected]>
1 parent 76be088 commit fe01291

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

kdump-lib.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -946,13 +946,16 @@ _crashkernel_parse()
946946
947947
# $1 crashkernel command line parameter
948948
# $2 size to be added
949+
# $3 optionally skip the first n items in command line
949950
_crashkernel_add()
950951
{
951-
local ck delta ret
952+
local ck delta skip ret
952953
local range size offset
954+
local count=0
953955
954956
ck="$1"
955957
delta="$2"
958+
skip="${3:-0}" # Default to 0 if third parameter not provided
956959
ret=""
957960
958961
while IFS=';' read -r size range offset; do
@@ -967,8 +970,12 @@ _crashkernel_add()
967970
ret+="$range:"
968971
fi
969972
970-
size=$(memsize_add "$size" "$delta") || return 1
973+
if ((count >= skip)); then
974+
size=$(memsize_add "$size" "$delta") || return 1
975+
fi
976+
971977
ret+="$size,"
978+
((count++))
972979
done < <(_crashkernel_parse "$ck")
973980
974981
echo "${ret%,}"

0 commit comments

Comments
 (0)