2nd kernel has very limited memory. Allocating huge pages will probably trigger OOM. So let's remove hugepages and hugepagesz kernel parameters for 2nd kernel when 1st kernel are using them.
If user wants huge pages cmdline in 2nd kernel, he/she can still specify it through KERNEL_COMMANDLINE_APPEND in /etc/sysconfig/kdump.
This patch adds a new function remove_cmdline(). It takes a list of kernel parameters as its arguments and remove them from 1st kernel cmdline or KERNEL_COMMANDLINE if set in /etc/sysconfig/kdump. However It wouldn't touch user specified KDUMP_COMMANDLINE_APPEND in /etc/sysconfig/kdump.
Signed-off-by: WANG Chao chaowang@redhat.com --- kdumpctl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl index 36e969f..8aaeb97 100755 --- a/kdumpctl +++ b/kdumpctl @@ -16,6 +16,16 @@ if [ -f /etc/sysconfig/kdump ]; then . /etc/sysconfig/kdump fi
+function remove_cmdline() +{ + for arg in $@; do + KDUMP_COMMANDLINE=`echo $KDUMP_COMMANDLINE | \ + sed -e "s/\b$arg=[^ ]*\b//g" \ + -e "s/\b$arg\b//g" \ + -e "s/\s+/ /g"` + done +} + function save_core() { coredir="/var/crash/`date +"%Y-%m-%d-%H:%M"`" @@ -221,8 +231,8 @@ function load_kdump() then KDUMP_COMMANDLINE=`cat /proc/cmdline` fi + remove_cmdline crashkernel hugepages hugepagesz
- KDUMP_COMMANDLINE=`echo $KDUMP_COMMANDLINE | sed -e 's/crashkernel=[^ ]*//'` KDUMP_COMMANDLINE="${KDUMP_COMMANDLINE} ${KDUMP_COMMANDLINE_APPEND}"
$KEXEC $KEXEC_ARGS $standard_kexec_args \