Skip to content

Commit 0186557

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 edb8363 commit 0186557

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
@@ -975,6 +975,24 @@ _crashkernel_add()
975975
echo "${ret%,}"
976976
}
977977
978+
979+
find_nr_cpus()
980+
{
981+
local _cmdline_append
982+
local _nr_cpus
983+
984+
# shellcheck disable=SC2153
985+
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
986+
_cmdline_append="$FADUMP_COMMANDLINE_APPEND"
987+
else
988+
_cmdline_append="$KDUMP_COMMANDLINE_APPEND"
989+
fi
990+
_nr_cpus=$(echo "$_cmdline_append" | sed -n 's/.*nr_cpus=\([0-9]\+\).*/\1/p')
991+
ddebug "Configured nr_cpus=$_nr_cpus"
992+
echo "$_nr_cpus"
993+
}
994+
995+
978996
# get default crashkernel
979997
# $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable
980998
# $2 kernel-release, if not specified, got by _get_kdump_kernel_version
@@ -1025,6 +1043,14 @@ kdump_get_arch_recommend_crashkernel()
10251043
has_mlx5 && ((_delta += 150))
10261044
fi
10271045
elif [[ $_arch == "ppc64le" ]]; then
1046+
local _per_cpu_area
1047+
local _nr_cpus
1048+
1049+
# 1MB per CPU
1050+
_per_cpu_area=1
1051+
_nr_cpus=$(find_nr_cpus)
1052+
1053+
_delta=$(( _delta + _per_cpu_area * _nr_cpus ))
10281054
if [[ $_dump_mode == "fadump" ]]; then
10291055
_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"
10301056
else

0 commit comments

Comments
 (0)