Hello systemd developers,

Currently, I am working on a task to reduce the boot time of an embedded 
product. systemd is used as the init system. I have a couple of questions, 
could you please clarify?


1.   From the systemd-analyze plot, I am seeing that it takes around 2 seconds 
to load the systemd unit files. Is there any way to reduce this time? I read a 
blog about systemd-readahead and systemd-replay services used in such cases to 
reduce the loading time, but it also have mentioned that the services are not 
maintained in the latest systemd versions. Is it advisable to use such services?
There still are other readahead implementations, although I doubt they'll help 
at all if you're reading from flash memory... also, they usually run as regular 
early services, after all units have loaded.

In fact, if something like *unit loading* is slow, you might have other 
problems... Use systemd-bootchart or other similar tools to figure out whether 
the loading is I/O-bound or CPU-bound. It could also be that some *unit 
generators* take a long time to run – consider masking or outright deleting 
some of them.

Many thanks for your reply. Ya, I also have a similar question in mind so I 
tried to get the information from bootchart. But the flash system used in the 
project is NAND flash and I am seeing the disk utilization part of the 
bootchart to be empty. I had a discussion about this with a developer from 
another blog, he told me  currently measurement is supported only for NOR 
flash. I am not sure if this is correct info. Do you have any idea on how can I 
measure the I/O during the startup. I have attached the part of bootchart for 
the reference.

2.   There are some systemd services which are used mostly for debugging 
purposes, so I tried to mask those services. My question is if the service is 
masked , do the service files gets loaded during the systemd initialization? I 
have masked around 5 services but I am not seeing any reduction in the systemd 
unit files loading time though there is a considerable reduction in the overall 
boot time.
AFAIK, no; systemd stops looking after it finds the first matching unit.

You could also remove the unneeded unit files entirely and compare the results. 
(But see reply to #1 first.)

3.       I have read that the preferred way to have the mount points is to 
write in /etc/fstab. This will create a *.mount file using 
systemd_fstab_generator. I am seeing that in the project for the debugfs there 
is a systemd mount file defined in  /lib/systemd/system/ and also an option 
present in /etc/fstab (‘debugfs  /sys/kernel/debug  debugfs noauto 0 0’).
On embedded systems, where you make your own rules, I'd say creating your own 
mount units would be more direct and easier to debug – also possibly avoiding a 
slow generator call.

(Though, on the other hand, some filesystems are mounted by 
src/core/mount-setup.c before processing any units. Later on, 
systemd-remount-fs applies options from fstab but not from custom .mount 
units...)

Which file has precedence when the system is  initialized?

/lib/systemd/system/sys-kernel-debug.mount
or
/run/systemd/generator/sys-kernel-debug.mount

fstab takes priority over packaged .mount units – it's one of the ways 
sysadmins can override systemd default mount options.

The (mostly) full order is:

* /run/systemd/system
* /run/systemd/generator.early
* /etc/systemd/system
* /run/systemd/system
* /run/systemd/generator
* /usr/lib/systemd/system
* /lib/systemd/system
* /run/systemd/generator.late

See src/shared/path-lookup.c for the full (not-quite-documented) details.

--
Mantas Mikulėnas <graw...@gmail.com<mailto:graw...@gmail.com>>
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to