manual_add_modules is slow / consumes the most time
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
initramfs-tools (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
I sprinkled mkinitramfs with "date -Ins" to see where most time is spent. I ran the [1] test case in a chroot on my laptop. mkinitramfs took 18.3 seconds. The most time consuming parts:
* 10.13 s (51.4%) auto_add_modules
* 7.20 s (36.5%) run_scripts_
* 1.27 s (6.4%) final { cat; cpio; cpio|compress } > $outfile
The remaining 1.11 seconds are spread over the remaining parts.
Following hooks in /usr/share/
* 4.56s (63.3%) framebuffer
* 0.87s (12.1%) plymouth
* 0.81s (11.3%) cryptroot
* 0.23s (3.2%) lvm2
* 0.18s (2.5%) udev
* 0.17s (2.4%) mdadm
The remaining 0.38 seconds are spread over the remaining dozen of hooks.
The framebuffer hook just calls copy_modules_dir and manual_add_modules multiple times. auto_add_modules calls copy_modules_dir multiple times and manual_add_modules. copy_modules_dir calls find and then
manual_add_modules.
So most time will be spent in manual_add_modules. This function calls modprobe on the modules, copies the modules, and add_firmware on the firmwares from a "modinfo -F firmware" call.
Replacing manual_add_modules by a call to /usr/lib/
[1] schroot-wrapper -p linux-image-
tags: | added: patch |
Changed in initramfs-tools (Ubuntu): | |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in initramfs-tools (Ubuntu): | |
status: | Triaged → Fix Committed |
Attached the tested change (verified that the content of the initramfs stays the same).
I am not uploading this change, because dracut-core is in universe.