Accessing squashfs with lzma compression is ~16% slower in 5.15 when compared to 5.4, on an RPi3 B+

Bug #1975688 reported by Alfonso Sanchez-Beato
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux-raspi (Ubuntu)
New
Undecided
Unassigned

Bug Description

On the server image on an RPi3 B+, I run this script:

```
#!/bin/bash -eu
mount_and_read()
{
    local snap=$1
    local mnt_d=$2
    mount "$snap" "$mnt_d"

    # We should not use /dev/null here, see
    # https://unix.stackexchange.com/questions/512362/why-does-tar-appear-to-skip-file-contents-when-output-file-is-dev-null
    tar -cO "$mnt_d"/ > /dev/zeros
}

snap_d=$(mktemp -d)
for i in {1..3}; do
    sync && echo 3 > /proc/sys/vm/drop_caches
    time mount_and_read "$1" "$snap_d"
    umount "$snap_d"
done
rmdir "$snap_d"
```

With these commands:
$ sudo mount -t tmpfs -o size=400M tmpfs tmpfs/
$ cd tmpfs
$ snap download core22
$ sudo ../measure-snap-mnt.sh core22_169.snap

I get these results on 20.04:
real 0m21.667s
user 0m0.302s
sys 0m20.299s

real 0m21.650s
user 0m0.351s
sys 0m20.417s

real 0m21.718s
user 0m0.285s
sys 0m20.528s

On 22.04 server image:
real 0m25.084s
user 0m0.407s
sys 0m23.778s

real 0m25.064s
user 0m0.397s
sys 0m23.768s

real 0m25.051s
user 0m0.369s
sys 0m23.803s

Which is a considerable difference. This affects snaps compressed with xz, and although these measurements are for server the bigger impact is on UC images, where the boot time increases considerably because of this.

Tags: kern-3405
summary: Accessing squashfs with lzma compression is ~16% slower in 5.15 when
- compared to 5.4
+ compared to 5.4, on an RPi3 B+
Juerg Haefliger (juergh)
tags: added: kern-3405
Revision history for this message
Valentin David (valentin.david) wrote :

I have looked into it a bit. I have noticed that some functions were not inlined in 5.15, but were inlined in 5.4. For example `lzma_literal` and `lzma_match` (see difference in System.map). After removing `CONFIG_DEBUG_SECTION_MISMATCH=y` from `debian/rules.d/0-common-vars.mk` (I am not sure why it is there, maybe a left over for some debugging), I got those functions to be inlined in 5.15. However while there is some measurable speed gain, it is very small, and it seems to be a only small fraction of the issue.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.