I found using "cat $KDUMP_CONFIG_FILE|grep -v "^#"|while read ..."
instead of "while read ... do ...; done < $KDUMP_CONFIG_FILE" will
make the script run faster.
(in case of no initramfs rebuild)
Before this patchset:
$ time kdumpctl start
kexec: loaded kdump kernel
Starting kdump: [OK]
real 0m0.854s
user 0m0.389s
sys 0m0.582s
After this patchset:
$ time kdumpctl start
kexec: loaded kdump kernel
Starting kdump: [OK]
real 0m0.465s
user 0m0.305s
sys 0m0.194s
Now most of start time is consumed by kexec syscall(around 0.330s)
which is impossible for us to optimize from kdump side.
Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
---
Please append to "[PATCH v2 0/3] optimize kdump service start time in case of no
initramfs rebuild".
kdumpctl | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 11d7f1f..d075a1a 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -365,7 +365,7 @@ check_config()
return 1
}
- while read config_opt config_val; do
+ cat $KDUMP_CONFIG_FILE | grep -v "^#" | while read config_opt config_val; do
# remove inline comments after the end of a directive.
config_val=$(strip_comments $config_val)
case "$config_opt" in
@@ -386,7 +386,7 @@ check_config()
return 1;
;;
esac
- done < $KDUMP_CONFIG_FILE
+ done
check_default_config || return 1
@@ -792,7 +792,7 @@ load_kdump()
check_ssh_config()
{
- while read config_opt config_val; do
+ cat $KDUMP_CONFIG_FILE | grep -v "^#" | while read config_opt config_val; do
# remove inline comments after the end of a directive.
config_val=$(strip_comments $config_val)
case "$config_opt" in
@@ -813,7 +813,7 @@ check_ssh_config()
*)
;;
esac
- done < $KDUMP_CONFIG_FILE
+ done
#make sure they've configured kdump.conf for ssh dumps
local SSH_TARGET=`echo -n $DUMP_TARGET | sed -n '/.*@/p'`
--
1.8.3.1
Show replies by date