kdumpctl: call strip_comments only when necessary to speedup
The "time kdumpctl start" command shows that strip_comments() consumes lots of cpu time. By only calling it when necessary, it saves us nearly half second. Tested on my Fedora kvm machine. Before this patch: $ time kdumpctl start kexec: loaded kdump kernel Starting kdump: [OK] real 0m1.849s user 0m1.497s sys 0m0.462s After this patch: $ time kdumpctl start kexec: loaded kdump kernel Starting kdump: [OK] real 0m1.344s user 0m1.195s sys 0m0.195s Signed-off-by: Xunlei Pang <xlpang@redhat.com> Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
parent
7f725ef13a
commit
2b4b7a6374
10
kdumpctl
10
kdumpctl
@ -366,12 +366,12 @@ check_config()
|
|||||||
}
|
}
|
||||||
|
|
||||||
while read config_opt config_val; do
|
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
|
case "$config_opt" in
|
||||||
\#* | "")
|
\#* | "")
|
||||||
;;
|
;;
|
||||||
raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
|
raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
|
||||||
|
# remove inline comments after the end of a directive.
|
||||||
|
config_val=$(strip_comments $config_val)
|
||||||
[ -z "$config_val" ] && {
|
[ -z "$config_val" ] && {
|
||||||
echo "Invalid kdump config value for option $config_opt."
|
echo "Invalid kdump config value for option $config_opt."
|
||||||
return 1;
|
return 1;
|
||||||
@ -800,10 +800,10 @@ load_kdump()
|
|||||||
check_ssh_config()
|
check_ssh_config()
|
||||||
{
|
{
|
||||||
while read config_opt config_val; do
|
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
|
case "$config_opt" in
|
||||||
sshkey)
|
sshkey)
|
||||||
|
# remove inline comments after the end of a directive.
|
||||||
|
config_val=$(strip_comments $config_val)
|
||||||
if [ -f "$config_val" ]; then
|
if [ -f "$config_val" ]; then
|
||||||
# canonicalize the path
|
# canonicalize the path
|
||||||
SSH_KEY_LOCATION=$(/usr/bin/readlink -m $config_val)
|
SSH_KEY_LOCATION=$(/usr/bin/readlink -m $config_val)
|
||||||
@ -812,9 +812,11 @@ check_ssh_config()
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
path)
|
path)
|
||||||
|
config_val=$(strip_comments $config_val)
|
||||||
SAVE_PATH=$config_val
|
SAVE_PATH=$config_val
|
||||||
;;
|
;;
|
||||||
ssh)
|
ssh)
|
||||||
|
config_val=$(strip_comments $config_val)
|
||||||
DUMP_TARGET=$config_val
|
DUMP_TARGET=$config_val
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
Loading…
Reference in New Issue
Block a user