[systemd-devel] Exploring Minimal Systemd in Initramfs for Faster Boot

Umut Tezduyar Lindskog Umut.Tezduyar at axis.com
Thu Sep 26 06:43:40 UTC 2024


Thanks for the link Brian. Very valuable.

Have you discussed moving cntvct-log<file:///CentOS/automotive/src/boot-time-analysis-tools/-/tree/main/cntvct-log> to systemd-analyze? IMHO, systemd can have better control when the target is reached to record the wall time.

Umut

From: systemd-devel <systemd-devel-bounces at lists.freedesktop.org> on behalf of Brian Masney <bmasney at redhat.com>
Date: Thursday, 26 September 2024 at 03:07
To: Dharma.B at microchip.com <Dharma.B at microchip.com>
Cc: serenissi at inventati.org <serenissi at inventati.org>, systemd-devel at lists.freedesktop.org <systemd-devel at lists.freedesktop.org>
Subject: Re: [systemd-devel] Exploring Minimal Systemd in Initramfs for Faster Boot
On Wed, Sep 25, 2024 at 03:53:36PM +0000, Dharma.B at microchip.com wrote:
> yes something similar to this, I will experiment this and get back to you.
>
> and I think since the egt service and its libraries depend on the full
> rootfs, integrating initramfs might not provide significant benefits in
> terms of faster launch time. The time saved by using an initramfs to
> launch basic services earlier would likely be offset by the delay in
> mounting the root filesystem, which is necessary for accessing the egt
> libraries.

There are some drawbacks to putting your early service in the initramfs
and having it persist across the switch root to when systemd is started
again from the root filesystem.

- The initrd is a cpio archive, and increasing the size of the initrd is
  going to increase the kernel boot time since it will need to
  uncompress and extract the larger cpio archive.

- Any services started from the initrd will be started before the
  SELinux policy is loaded. Services started from the initrd will run
  with the kernel_t label.

- Services started from the initrd can't depend on almost anything like
  mounts, devices, services, dbus, etc so it's difficult to develop
  software of any complexity.

- Adding all of these dependencies to the initrd is only going to move
  the timing bottlenecks booting from the root filesystem to the initrd.

- Directives like Restart=always will likely not work as expected.

Personally I think that you should have the initramfs be small enough to
only get you to the root filesystem and start your early service from
the root filesystem.

Shameless self plug: Here's a presentation that I gave last month at
DevConf.us in Boston with Eric Curtin and Ed Chong about some of the
boot speed optimizations that a group of us worked on at Red Hat:
https://pretalx.com/devconf-us-2024/talk/HXVPHC/ . The talk also
lists some upstream patch sets that you will want to consider
including in your kernel to help with boot time.

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240926/8188f263/attachment-0001.htm>


More information about the systemd-devel mailing list