|
|
e83cdd |
From 7ee74e539dba61c3765afe34426b085eff0de027 Mon Sep 17 00:00:00 2001
|
|
|
e83cdd |
From: Kairui Song <kasong@redhat.com>
|
|
|
e83cdd |
Date: Thu, 21 Feb 2019 13:18:37 +0800
|
|
|
e83cdd |
Subject: [PATCH] dracut: let module handling function accept optional path
|
|
|
e83cdd |
option
|
|
|
e83cdd |
|
|
|
e83cdd |
Let the caller pass in the module path instead of try to find the module
|
|
|
e83cdd |
path everytime. This helps optimize the overall runtime.
|
|
|
e83cdd |
|
|
|
e83cdd |
Test results (3 rounds) on Fedora 30 in KVM VM with 8 CPUs, 2G memory, HDD:
|
|
|
e83cdd |
|
|
|
e83cdd |
$ time ./dracut.sh --local --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode 'strict' -o 'plymouth dash resume ifcfg' --mount '/dev/mapper/fedora-root /sysroot xfs defaults' --no-hostonly-default-device -f initramfs.img
|
|
|
e83cdd |
Before the commit:
|
|
|
e83cdd |
real 0m11.782s | real 0m11.505s | real 0m11.958s
|
|
|
e83cdd |
user 0m9.169s | user 0m9.218s | user 0m9.327s
|
|
|
e83cdd |
sys 0m10.839s | sys 0m10.829s | sys 0m10.925s
|
|
|
e83cdd |
|
|
|
e83cdd |
After this commit:
|
|
|
e83cdd |
real 0m9.866s | real 0m9.580s | real 0m9.638s
|
|
|
e83cdd |
user 0m9.048s | user 0m9.142s | user 0m9.120s
|
|
|
e83cdd |
sys 0m7.411s | sys 0m7.775s | sys 0m7.745s
|
|
|
e83cdd |
|
|
|
e83cdd |
Test result of building a ordinary image:
|
|
|
e83cdd |
|
|
|
e83cdd |
$ time ./dracut.sh --local --quiet -f initramfs.img
|
|
|
e83cdd |
Before the commit:
|
|
|
e83cdd |
real 0m34.697s | real 0m34.371s | real 0m35.122s
|
|
|
e83cdd |
user 0m27.608s | user 0m27.524s | user 0m27.705s
|
|
|
e83cdd |
sys 0m22.341s | sys 0m22.032s | sys 0m22.246s
|
|
|
e83cdd |
|
|
|
e83cdd |
After the commit:
|
|
|
e83cdd |
real 0m31.914s | real 0m31.006 | real 0m31.289ss
|
|
|
e83cdd |
user 0m27.315s | user 0m27.324 | user 0m27.290ss
|
|
|
e83cdd |
sys 0m19.051s | sys 0m18.916 | sys 0m19.022ss
|
|
|
e83cdd |
|
|
|
e83cdd |
This will have an ~2s speed up.
|
|
|
e83cdd |
|
|
|
e83cdd |
Signed-off-by: Kairui Song <kasong@redhat.com>
|
|
|
e83cdd |
(cherry picked from commit 5916d31b24ad9eb21fd376929a96c459813315a1)
|
|
|
e83cdd |
|
|
|
e83cdd |
Cherry-picked from: 5916d31b
|
|
|
e83cdd |
Resolves: #1734047
|
|
|
e83cdd |
---
|
|
|
e83cdd |
dracut-init.sh | 4 ++++
|
|
|
e83cdd |
dracut.sh | 8 ++++----
|
|
|
e83cdd |
2 files changed, 8 insertions(+), 4 deletions(-)
|
|
|
e83cdd |
|
|
|
e83cdd |
diff --git a/dracut-init.sh b/dracut-init.sh
|
|
|
e83cdd |
index b1ac9966..ab07cabf 100644
|
|
|
e83cdd |
--- a/dracut-init.sh
|
|
|
e83cdd |
+++ b/dracut-init.sh
|
|
|
e83cdd |
@@ -154,6 +154,10 @@ dracut_no_switch_root() {
|
|
|
e83cdd |
>"$initdir/lib/dracut/no-switch-root"
|
|
|
e83cdd |
}
|
|
|
e83cdd |
|
|
|
e83cdd |
+dracut_module_path() {
|
|
|
e83cdd |
+ echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }
|
|
|
e83cdd |
+}
|
|
|
e83cdd |
+
|
|
|
e83cdd |
if ! [[ $DRACUT_INSTALL ]]; then
|
|
|
e83cdd |
DRACUT_INSTALL=$(find_binary dracut-install)
|
|
|
e83cdd |
fi
|
|
|
e83cdd |
diff --git a/dracut.sh b/dracut.sh
|
|
|
e83cdd |
index 8144a16e..f270af76 100755
|
|
|
e83cdd |
--- a/dracut.sh
|
|
|
e83cdd |
+++ b/dracut.sh
|
|
|
e83cdd |
@@ -1373,7 +1373,7 @@ do_print_cmdline()
|
|
|
e83cdd |
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
|
|
e83cdd |
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
|
|
|
e83cdd |
[[ ${_mods_to_print[$_d_mod]} ]] || continue
|
|
|
e83cdd |
- module_cmdline "$_d_mod"
|
|
|
e83cdd |
+ module_cmdline "$_d_mod" "$moddir"
|
|
|
e83cdd |
done
|
|
|
e83cdd |
unset moddir
|
|
|
e83cdd |
}
|
|
|
e83cdd |
@@ -1454,14 +1454,14 @@ for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
|
|
e83cdd |
dinfo "*** Including module: $_d_mod ***"
|
|
|
e83cdd |
fi
|
|
|
e83cdd |
if [[ $kernel_only == yes ]]; then
|
|
|
e83cdd |
- module_installkernel "$_d_mod" || {
|
|
|
e83cdd |
+ module_installkernel "$_d_mod" "$moddir" || {
|
|
|
e83cdd |
dfatal "installkernel failed in module $_d_mod"
|
|
|
e83cdd |
exit 1
|
|
|
e83cdd |
}
|
|
|
e83cdd |
else
|
|
|
e83cdd |
- module_install "$_d_mod"
|
|
|
e83cdd |
+ module_install "$_d_mod" "$moddir"
|
|
|
e83cdd |
if [[ $no_kernel != yes ]]; then
|
|
|
e83cdd |
- module_installkernel "$_d_mod" || {
|
|
|
e83cdd |
+ module_installkernel "$_d_mod" "$moddir" || {
|
|
|
e83cdd |
dfatal "installkernel failed in module $_d_mod"
|
|
|
e83cdd |
exit 1
|
|
|
e83cdd |
}
|
|
|
e83cdd |
|