Tested on amd64 laptop in a chroot. Without noble-proposed:

```
$ schroot-wrapper -c noble -u root -p 
initramfs-tools,cloud-initramfs-copymods,cloud-initramfs-rescuevol,cloud-initramfs-dyn-netconf,cloud-initramfs-growroot,cloud-initramfs-rooturl,cloud-initramfs-updateroot,overlayroot,hyperfine,linux-image-generic
# hyperfine "update-initramfs -u"
Benchmark 1: update-initramfs -u
  Time (mean ± σ):      7.952 s ±  0.232 s    [User: 2.699 s, System: 5.750 s]
  Range (min … max):    7.539 s …  8.394 s    10 runs
 
# lsinitramfs /boot/initrd.img > /files
# dpkg -l | grep -E 
'(cryptsetup|initramfs|dracut|open-iscsi|lvm2|thin-provisioning-tools|overlayroot)'
ii  busybox-initramfs                    1:1.36.1-6ubuntu3.1               
amd64        Standalone shell setup for initramfs
ii  cloud-initramfs-copymods             0.48                              all  
        copy initramfs modules into root filesystem for later use
ii  cloud-initramfs-dyn-netconf          0.48                              all  
        write a network interface file in /run for BOOTIF
ii  cloud-initramfs-growroot             0.48                              all  
        automatically resize the root partition on first boot
ii  cloud-initramfs-rescuevol            0.48                              all  
        boot off a rescue volume rather than root filesystem
ii  cloud-initramfs-rooturl              0.48                              all  
        use a tarball or squashfs image in a url as the root filesystem
ii  cloud-initramfs-updateroot           0.48                              all  
        extract a tarball over root filesystem before pivot
ii  cryptsetup                           2:2.7.0-1ubuntu4                  
amd64        disk encryption support - startup scripts
ii  cryptsetup-bin                       2:2.7.0-1ubuntu4                  
amd64        disk encryption support - command line tools
ii  dracut-install                       060+5-1ubuntu3.2                  
amd64        dracut is an event driven initramfs infrastructure (dracut-install)
ii  initramfs-tools                      0.142ubuntu25.1                   all  
        generic modular initramfs generator (automation)
ii  initramfs-tools-bin                  0.142ubuntu25.1                   
amd64        binaries used by initramfs-tools
ii  initramfs-tools-core                 0.142ubuntu25.1                   all  
        generic modular initramfs generator (core tools)
ii  libcryptsetup12:amd64                2:2.7.0-1ubuntu4                  
amd64        disk encryption support - shared library
ii  libklibc:amd64                       2.0.13-4ubuntu0.1                 
amd64        minimal libc subset for use with initramfs
ii  overlayroot                          0.48                              all  
        use an overlayfs on top of a read-only root filesystem
```

With noble-proposed:

```
$ schroot-wrapper -c noble -u root -p 
initramfs-tools,cloud-initramfs-copymods,cloud-initramfs-rescuevol,cloud-initramfs-dyn-netconf,cloud-initramfs-growroot,cloud-initramfs-rooturl,cloud-initramfs-updateroot,overlayroot,hyperfine,linux-image-6.8.0-41-generic
 -e
# hyperfine "update-initramfs -u"
Benchmark 1: update-initramfs -u
  Time (mean ± σ):      7.647 s ±  0.277 s    [User: 2.631 s, System: 5.502 s]
  Range (min … max):    7.139 s …  7.973 s    10 runs
 
# dpkg -l | grep -E 
'(cryptsetup|initramfs|dracut|open-iscsi|lvm2|thin-provisioning-tools|overlayroot)'
ii  busybox-initramfs                    1:1.36.1-6ubuntu3.1               
amd64        Standalone shell setup for initramfs
ii  cloud-initramfs-copymods             0.49~24.04.1                      all  
        copy initramfs modules into root filesystem for later use
ii  cloud-initramfs-dyn-netconf          0.49~24.04.1                      all  
        write a network interface file in /run for BOOTIF
ii  cloud-initramfs-growroot             0.49~24.04.1                      all  
        automatically resize the root partition on first boot
ii  cloud-initramfs-rescuevol            0.49~24.04.1                      all  
        boot off a rescue volume rather than root filesystem
ii  cloud-initramfs-rooturl              0.49~24.04.1                      all  
        use a tarball or squashfs image in a url as the root filesystem
ii  cloud-initramfs-updateroot           0.49~24.04.1                      all  
        extract a tarball over root filesystem before pivot
ii  cryptsetup                           2:2.7.0-1ubuntu4.1                
amd64        disk encryption support - startup scripts
ii  cryptsetup-bin                       2:2.7.0-1ubuntu4.1                
amd64        disk encryption support - command line tools
ii  dracut-install                       060+5-1ubuntu3.2                  
amd64        dracut is an event driven initramfs infrastructure (dracut-install)
ii  initramfs-tools                      0.142ubuntu25.2                   all  
        generic modular initramfs generator (automation)
ii  initramfs-tools-bin                  0.142ubuntu25.2                   
amd64        binaries used by initramfs-tools
ii  initramfs-tools-core                 0.142ubuntu25.2                   all  
        generic modular initramfs generator (core tools)
ii  libcryptsetup12:amd64                2:2.7.0-1ubuntu4.1                
amd64        disk encryption support - shared library
ii  libklibc:amd64                       2.0.13-4ubuntu0.1                 
amd64        minimal libc subset for use with initramfs
ii  overlayroot                          0.49~24.04.1                      all  
        use an overlayfs on top of a read-only root filesystem
# lsinitramfs /boot/initrd.img > /files
```

The creation time is slightly faster and diffing the content of the
initrds show no difference:

```
diff -u /run/schroot/mount/noble-*/files
```

So verified the SRU successfully.


** Tags removed: verification-needed verification-needed-noble
** Tags added: verification-done verification-done-noble

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to initramfs-tools in Ubuntu.
https://bugs.launchpad.net/bugs/2065180

Title:
  performance regression in dracut-install 060

Status in Dracut:
  New
Status in cloud-initramfs-tools package in Ubuntu:
  Fix Released
Status in cryptsetup package in Ubuntu:
  Fix Released
Status in dracut package in Ubuntu:
  Fix Released
Status in initramfs-tools package in Ubuntu:
  Fix Released
Status in lvm2 package in Ubuntu:
  Fix Released
Status in miniramfs package in Ubuntu:
  Fix Released
Status in open-iscsi package in Ubuntu:
  Invalid
Status in thin-provisioning-tools package in Ubuntu:
  Fix Released
Status in cloud-initramfs-tools source package in Noble:
  Fix Committed
Status in cryptsetup source package in Noble:
  Fix Committed
Status in dracut source package in Noble:
  Fix Released
Status in initramfs-tools source package in Noble:
  Fix Committed
Status in lvm2 source package in Noble:
  Fix Committed
Status in miniramfs source package in Noble:
  New
Status in open-iscsi source package in Noble:
  Fix Released
Status in thin-provisioning-tools source package in Noble:
  Fix Released

Bug description:
  [ Impact ]

  When compared to Ubuntu 23.10, creating intramfs files with update-
  initramfs takes 2 to 5 times more time on ARM devices.

  IIUC, dracut-install usage was added to initramfs-tools to speed up
  the process. But now its way slower. Even running update-initramfs on
  jammy, which doesn't use dracut-install, is way faster then the time
  taken on Noble.

  first bad commit -
  
https://github.com/dracutdevs/dracut/commit/3de4c7313260fb600507c9b87f780390b874c870

  Updating the initrd on a Raspberry Pi Zero 2W on Ubuntu 24.04 (noble)
  with initramfs-tools 0.142ubuntu25.1 takes over six minutes:

  ```
  bdrung@zero2w:~$ sudo hyperfine --warmup 1 -r 10 "update-initramfs -u"
  Benchmark 1: update-initramfs -u
    Time (mean ± σ):     402.751 s ±  5.592 s    [User: 166.316 s, System: 
228.909 s]
    Range (min … max):   394.380 s … 411.445 s    10 runs
  ```

  [ Test Plan ]

  1. Measure `update-initramfs -u` before the update.
  2. Log the content of the initrd before the update: `lsinitramfs 
/boot/initrd.img`
  3. update dracut-install / initramfs-tools-core
  4. Measure `update-initramfs -u`. It should be faster (the performance 
improvements on amd64 should be very small and might be within the measurement 
uncertainty).
  5. Check with lsinitramfs that the content of the newly generated initrd 
hasn't changed.

  [ Where problems could occur ]

  The code that is responsible for including the kernel modules into the
  initrd is touched. Negative consequences could be that some needed
  kernel modules will not be included any more (should be covered by the
  test case) or that building new initrds will fail.

  The initramfs-tools fix changes how manual_add_modules behaves.
  `manual_add_modules` does not copy kernel modules, but queues them for
  being copied when the newly added function `apply_add_modules` is
  called.

  I checked all instances of calls to `manual_add_modules` for possible
  regressions (see comment #15). Only miniramfs needs to be adjusted to
  also call `apply_add_modules`. But this change could break consumers
  of the `manual_add_modules` function that are outside of the Ubuntu
  archive. I googled for `apply_add_modules` but found no public outside
  users.

  [ Benchmarks ]

  Stock noble on a Raspberry Pi Zero 2W:

  ```
  bdrung@zero2w:~$ sudo hyperfine -r 5 "update-initramfs -u"
  Benchmark 1: update-initramfs -u
    Time (mean ± σ): 415.664 s ± 6.015 s [User: 166.728 s, System: 232.523 s]
    Range (min … max): 409.139 s … 422.632 s 5 runs
  ```

  noble with dracut-install 060+5-1ubuntu3.1 (with linux 6.8.0-1006.6 on
  2024-07-01):

  ```
  bdrung@zero2w:~$ sudo hyperfine --warmup 1 -r 10 "update-initramfs -u"
  Benchmark 1: update-initramfs -u
    Time (mean ± σ):     248.054 s ±  5.569 s    [User: 67.410 s, System: 
169.412 s]
    Range (min … max):   238.909 s … 257.384 s    10 runs
  ```

  noble with dracut-install 060+5-1ubuntu3.2 (with linux 6.8.0-1007 on
  2024-07-11):

  ```
  bdrung@zero2w:~$ sudo hyperfine --warmup 1 -r 10 "update-initramfs -u"
  Benchmark 1: update-initramfs -u
    Time (mean ± σ): 232.001 s ± 5.678 s [User: 55.456 s, System: 166.510 s]
    Range (min … max): 222.120 s … 239.610 s 10 runs
  ```

  [ Reduce manual_add_modules calls ]

  Besides making the dracut-install calls faster, group the dracut-
  install calls. Since the fix in oracular can cause regressions in
  custom hooks that rely on the current behavior, the SRU takes a safe
  approach which includes following packages (stating how many dracut-
  install calls are used):

   * cryptsetup: 2 -> 1
   * lvm2: 8 -> 1
   * thin-provisioning-tools: 3 -> 1
   * open-iscsi: 9 -> 1
   * cloud-initramfs-tools: 5 -> 1

  dracut-install calls on a Raspberry Pi Zero 2W:

  | area                                 | before | noble SRU | oracular |
  |--------------------------------------|--------|-----------|----------|
  | auto_add_modules + apply_add_modules |    8   |     5     |     5    |
  | calls by hooks + apply_add_modules   |   42   |    20     |     2    |
  | hidden_dep_add_modules               |    1   |     1     |     1    |
  | total                                |   51   |    26     |     8    |

  [ Other Info ]

  $ lsb_release -rd
  No LSB modules are available.
  Description:  Ubuntu 24.04 LTS
  Release:      24.04

  $ apt-cache policy dracut-install
  dracut-install:
    Installed: 060+5-1ubuntu3
    Candidate: 060+5-1ubuntu3
    Version table:
   *** 060+5-1ubuntu3 500
          500 http://ports.ubuntu.com/ubuntu-ports noble/main arm64 Packages
          100 /var/lib/dpkg/status

To manage notifications about this bug go to:
https://bugs.launchpad.net/dracut/+bug/2065180/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to