FS#56417 - [mkinitcpio] lsinitcpio estimated extraction time is irrelevant due to io caches

Attached to Project: Arch Linux
Opened by Ceriel Jacobs (cj1) - Thursday, 23 November 2017, 07:48 GMT
Last edited by Dave Reisner (falconindy) - Saturday, 25 November 2017, 22:45 GMT
Task Type General Gripe
Category Arch Projects
Status Closed
Assigned To Dave Reisner (falconindy)
Architecture All
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Description: lsinitcpio (from package mkinitcpio) util lists an "Estimated extraction time" that is showing a value that is produced using cached disk io.

Initramfs will mostly be read during boot when disk cache is empty. Therefore using an uncached version makes sense. Or at least knowing that the results might not be the "realistic" value.

Additional info:
* package version: 24

Steps to reproduce:
1. Make both speed (lz4 -l; 5.2MiB) and size (lzma -9; 2.5MiB) initramfs
2. Make copies of the initramfs file and copied these files also onto a much slower USB2 stick (flash drive)
3. Purge i/o cache between each run using: sync && echo 3 | tee /proc/sys/vm/drop_caches

sdA 5.2MiB initramfs.img: Estimated extraction time: 0.077s (cached time: 0.028s)
sdB 5.2MiB initramfs.img: Estimated extraction time: 0.171s (cached time: 0.029s)

sdA 2.4MiB initramfs.img: Estimated extraction time: 0.514s (cached time: 0.497s)
sdB 2.4MiB initramfs.img: Estimated extraction time: 0.512s (cached time: 0.497s)

$ hdparm -t /dev/sdX1
stick A: 132 MB/sec (USB-3, sda)
stick B: 036 MB/sec (USB-2, sdb)

This task depends upon

Closed by  Dave Reisner (falconindy)
Saturday, 25 November 2017, 22:45 GMT
Reason for closing:  Fixed
Additional comments about closing:  lsinitcpio no longer tries to estimate read-from-disk time, only decompression time.
Comment by Dave Reisner (falconindy) - Friday, 24 November 2017, 16:48 GMT
Well, this is one reason why it's marked as an estimate. I would argue that it's more honest to do this on a *hot* cache rather than a cold one. It's described as "decompression time", not "read from disk and decompression time". The original intent in adding this was to provide a way of comparing timing for the various compression methods.

edit: no idea where i got the idea that it's decompression time. Still, the read-from-disk time is a constant regardless of the compression method, and maybe "decompression time" is exactly what lsinitcpio should advertise.
Comment by Ceriel Jacobs (cj1) - Saturday, 25 November 2017, 22:36 GMT
For most users read-from-disk time is low due to high sequential read speeds.

The exception are the Sound Blaster X-Fi Go users with a sequential read speed (slowness) of down till 0.63 MB/second. Then the ((5.2-2.5)/0.63 =) 4.3 seconds of extra read time are of significant importance.

Nearly each other x86_64 read flash device will read at at 4 MB/second or faster -> no issue.

Other flash media cases (like running on ARM CPU architecture, which can be 0.6MB/s slow too) are out of scope here.?
Comment by Dave Reisner (falconindy) - Saturday, 25 November 2017, 22:45 GMT
Again, the read time isn't interesting because it's constant. You can ballpark the relative read time by comparing file sizes between images.

You can consider this "fixed" by https://git.archlinux.org/mkinitcpio.git/commit/?id=8118efa675