Skip to content

Commit d96a9a3

Browse files
committed
powerpc: consider CPU count while calculating crashkernel value
The next patch in the series adds more CPUs to the capture kernel, which increases the memory requirement for the capture kernel. Experiments show that powerpc needs 1 MB of additional memory for every CPU added. Therefore, while calculating the crashkernel size, make sure to include an additional 1 MB for every CPU configured in the capture kernel. The changes are implemented in such a way that if the user changes the nr_cpus value in the kdump configuration, the script will adapt accordingly. Signed-off-by: Sourabh Jain <[email protected]>
1 parent 063548f commit d96a9a3

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

kdump-lib.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,24 @@ _crashkernel_add()
997997
echo "${ret%,}"
998998
}
999999
1000+
1001+
find_nr_cpus()
1002+
{
1003+
local _cmdline_append
1004+
local _nr_cpus
1005+
1006+
# shellcheck disable=SC2153
1007+
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
1008+
_cmdline_append="$FADUMP_COMMANDLINE_APPEND"
1009+
else
1010+
_cmdline_append="$KDUMP_COMMANDLINE_APPEND"
1011+
fi
1012+
_nr_cpus=$(echo "$_cmdline_append" | sed -n 's/.*nr_cpus=\([0-9]\+\).*/\1/p')
1013+
ddebug "Configured nr_cpus=$_nr_cpus"
1014+
echo "$_nr_cpus"
1015+
}
1016+
1017+
10001018
# get default crashkernel
10011019
# $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable
10021020
# $2 kernel-release, if not specified, got by _get_kdump_kernel_version
@@ -1047,6 +1065,14 @@ kdump_get_arch_recommend_crashkernel()
10471065
has_mlx5 && ((_delta += 150))
10481066
fi
10491067
elif [[ $_arch == "ppc64le" ]]; then
1068+
local _per_cpu_area
1069+
local _nr_cpus
1070+
1071+
# 1MB per CPU
1072+
_per_cpu_area=1
1073+
_nr_cpus=$(find_nr_cpus)
1074+
1075+
_delta=$(( _delta + _per_cpu_area * _nr_cpus ))
10501076
if [[ $_dump_mode == "fadump" ]]; then
10511077
_ck_cmdline="4G-16G:768M,16G-64G:1G,64G-128G:2G,128G-1T:4G,1T-2T:6G,2T-4T:12G,4T-8T:20G,8T-16T:36G,16T-32T:64G,32T-64T:128G,64T-:180G"
10521078
else

0 commit comments

Comments
 (0)