Allow user to tune between a better compression ratio or better initramfs build speed. And provide two example for user to use.
If compress_args is not set, then try to use the compression arguments with highest compression ratio.
Test result with given examples:
- With `compress_args xz -Xbcj x86 -Xdict-size 100%` # time kdumpctl rebuild kdump: Rebuilding /boot/initramfs-4.18.0-287.el8.dt4.x86_64kdump.img
real 0m29.896s user 0m37.784s sys 0m5.725s
Image size: 16441344 May 9 07:44 squash-root.img
- With `compress_args gzip -Xcompression-level 1` # time kdumpctl rebuild kdump: Rebuilding /boot/initramfs-4.18.0-287.el8.dt4.x86_64kdump.img
real 0m9.098s user 0m4.373s sys 0m4.508s
Image size: 21757952 May 9 07:45 squash-root.img
Signed-off-by: Kairui Song kasong@redhat.com --- kdump.conf | 13 +++++++++++++ kdumpctl | 2 +- mkdumprd | 29 +++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/kdump.conf b/kdump.conf index dea2e94..d86bc44 100644 --- a/kdump.conf +++ b/kdump.conf @@ -159,6 +159,18 @@ # - List of cluster node(s) except localhost, separated by spaces, # to send fence_kdump notifications to. # (this option is mandatory to enable fence_kdump). +# compress_args <compressor and args> +# - How the kdump initramfs should be compressed. +# Kdump compresses the initramfs into a squash image to same +# crashkernel runtime memory. More effective compression will +# save more memory but make initramfs compression slower. +# +# If not set, kdump will prefer to trade initramfs build time for a +# higher compression ratio. +# +# Some example args: +# - For better compression ratio (on x86): "xz -Xbcj x86 -Xdict-size 100%" +# - For faster initramfs building: "gzip -Xcompression-level 1" #
#raw /dev/vg/lv_kdump @@ -183,3 +195,4 @@ core_collector makedumpfile -l --message-level 7 -d 31 #dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3" #fence_kdump_args -p 7410 -f auto -c 0 -i 10 #fence_kdump_nodes node1 node2 +#compress_args xz diff --git a/kdumpctl b/kdumpctl index 009d259..15dbfbe 100755 --- a/kdumpctl +++ b/kdumpctl @@ -257,7 +257,7 @@ check_config() ext[234]|minix|btrfs|xfs|nfs|ssh) config_opt=_target ;; - sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|failure_action|default|final_action|force_rebuild|force_no_rebuild|fence_kdump_args|fence_kdump_nodes) + sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|failure_action|default|final_action|force_rebuild|force_no_rebuild|fence_kdump_args|fence_kdump_nodes|compress_args) ;; net|options|link_delay|disk_timeout|debug_mem_level|blacklist) derror "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives." diff --git a/mkdumprd b/mkdumprd index 50ebdc8..54c8eef 100644 --- a/mkdumprd +++ b/mkdumprd @@ -30,6 +30,7 @@ OVERRIDE_RESETTABLE=0
extra_modules="" dracut_args="--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict -o "plymouth dash resume ifcfg earlykdump"" +compress_args=""
readonly MKDUMPRD_TMPDIR="$(mktemp -d -t mkdumprd.XXXXXX)" [ -d "$MKDUMPRD_TMPDIR" ] || perror_exit "dracut: mktemp -p -d -t dracut.XXXXXX failed." @@ -460,6 +461,9 @@ do dracut_args) add_dracut_arg $config_val ;; + compress_args) + compress_args="$config_val" + ;; *) ;; esac @@ -480,6 +484,31 @@ if ! is_fadump_capable; then add_dracut_arg "--no-hostonly-default-device" fi
+if [[ -z $compress_args ]]; then + case $(uname -m) in + i686|i386|x86_64) + compress_args="xz -Xbcj x86" + ;; + aarch*|armv*) + compress_args="xz -Xbcj arm" + ;; + ppc*) + compress_args="xz -Xbcj powerpc" + ;; + sparc*) + compress_args="xz -Xbcj sparc" + ;; + ia64) + compress_args="xz -Xbcj ia64" + ;; + *) + compress_args="xz" + ;; + esac +fi + +add_dracut_arg "--comp "$compress_args"" + echo "$dracut_args $@" | xargs dracut
_rc=$?
On Mon, May 10, 2021 at 03:54:13PM +0800, Kairui Song wrote:
Allow user to tune between a better compression ratio or better initramfs build speed. And provide two example for user to use.
Only a typo needs to be fixed, s/example/examples.
This patch looks good to me.
Acked-by: Coiby Xu coxu@redhat.com
If compress_args is not set, then try to use the compression arguments with highest compression ratio.
Test result with given examples:
- With `compress_args xz -Xbcj x86 -Xdict-size 100%`
# time kdumpctl rebuild kdump: Rebuilding /boot/initramfs-4.18.0-287.el8.dt4.x86_64kdump.img
real 0m29.896s user 0m37.784s sys 0m5.725s
Image size: 16441344 May 9 07:44 squash-root.img
- With `compress_args gzip -Xcompression-level 1`
# time kdumpctl rebuild kdump: Rebuilding /boot/initramfs-4.18.0-287.el8.dt4.x86_64kdump.img
real 0m9.098s user 0m4.373s sys 0m4.508s
Image size: 21757952 May 9 07:45 squash-root.img
Signed-off-by: Kairui Song kasong@redhat.com
kdump.conf | 13 +++++++++++++ kdumpctl | 2 +- mkdumprd | 29 +++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/kdump.conf b/kdump.conf index dea2e94..d86bc44 100644 --- a/kdump.conf +++ b/kdump.conf @@ -159,6 +159,18 @@ # - List of cluster node(s) except localhost, separated by spaces, # to send fence_kdump notifications to. # (this option is mandatory to enable fence_kdump). +# compress_args <compressor and args> +# - How the kdump initramfs should be compressed. +# Kdump compresses the initramfs into a squash image to same +# crashkernel runtime memory. More effective compression will +# save more memory but make initramfs compression slower. +# +# If not set, kdump will prefer to trade initramfs build time for a +# higher compression ratio. +# +# Some example args: +# - For better compression ratio (on x86): "xz -Xbcj x86 -Xdict-size 100%" +# - For faster initramfs building: "gzip -Xcompression-level 1" #
#raw /dev/vg/lv_kdump @@ -183,3 +195,4 @@ core_collector makedumpfile -l --message-level 7 -d 31 #dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3" #fence_kdump_args -p 7410 -f auto -c 0 -i 10 #fence_kdump_nodes node1 node2 +#compress_args xz diff --git a/kdumpctl b/kdumpctl index 009d259..15dbfbe 100755 --- a/kdumpctl +++ b/kdumpctl @@ -257,7 +257,7 @@ check_config() ext[234]|minix|btrfs|xfs|nfs|ssh) config_opt=_target ;;
sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|failure_action|default|final_action|force_rebuild|force_no_rebuild|fence_kdump_args|fence_kdump_nodes)
net|options|link_delay|disk_timeout|debug_mem_level|blacklist) derror "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives."sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|failure_action|default|final_action|force_rebuild|force_no_rebuild|fence_kdump_args|fence_kdump_nodes|compress_args) ;;
diff --git a/mkdumprd b/mkdumprd index 50ebdc8..54c8eef 100644 --- a/mkdumprd +++ b/mkdumprd @@ -30,6 +30,7 @@ OVERRIDE_RESETTABLE=0
extra_modules="" dracut_args="--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict -o "plymouth dash resume ifcfg earlykdump"" +compress_args=""
readonly MKDUMPRD_TMPDIR="$(mktemp -d -t mkdumprd.XXXXXX)" [ -d "$MKDUMPRD_TMPDIR" ] || perror_exit "dracut: mktemp -p -d -t dracut.XXXXXX failed." @@ -460,6 +461,9 @@ do dracut_args) add_dracut_arg $config_val ;;
- compress_args)
compress_args="$config_val"
*) ;; esac;;
@@ -480,6 +484,31 @@ if ! is_fadump_capable; then add_dracut_arg "--no-hostonly-default-device" fi
+if [[ -z $compress_args ]]; then
- case $(uname -m) in
i686|i386|x86_64)
compress_args="xz -Xbcj x86"
;;
aarch*|armv*)
compress_args="xz -Xbcj arm"
;;
ppc*)
compress_args="xz -Xbcj powerpc"
;;
sparc*)
compress_args="xz -Xbcj sparc"
;;
ia64)
compress_args="xz -Xbcj ia64"
;;
*)
compress_args="xz"
;;
- esac
+fi
+add_dracut_arg "--comp "$compress_args""
echo "$dracut_args $@" | xargs dracut
_rc=$?
2.30.2 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure