Skip to content

Commit 2b6f34b

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 063548f commit 2b6f34b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

kdump-lib.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,16 +969,24 @@ _crashkernel_parse()
969969
970970
# $1 crashkernel command line parameter
971971
# $2 size to be added
972+
# $3 optionally skip the first n items in command line
972973
_crashkernel_add()
973974
{
974-
local ck delta ret
975+
local ck delta skip ret
975976
local range size offset
977+
local count=0
976978
977979
ck="$1"
978980
delta="$2"
981+
skip="${3:-0}" # Default to 0 if third parameter not provided
979982
ret=""
980983
981984
while IFS=';' read -r size range offset; do
985+
if ((count < skip)); then
986+
((count++))
987+
continue
988+
fi
989+
982990
if [[ -n $offset ]]; then
983991
ret="${ret%,}$offset"
984992
break

0 commit comments

Comments
 (0)