Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
manager: Add deferred parsing of mountinfo
Manager start (measured via readiness notification) takes time that is proportionate to number of entries in /proc/self/mountinfo since all mount units must be enumerated. This is problematic for user instances because: a) they can start at times when lots of entries are created already, b) their start latency propagates directly to user sessions establishment via pam_systemd. Alleviate this latency by postponing full mountinfo parsing after the manager notifies its readiness. The reasoning is that mount units that are somehow relevant during startup of the user instance are referenced by other units and they would be loaded on demand anyway. The complete set of all mounts can be loaded later. Use 'post' event source (instead of 'defer') since there is no point in checking readiness in event loop when no other event was processed. If a mount happens concurrently to the startup (mountinfo event), manager will parse it completely, that is life. Fortunately, user-runtime-dir@.service is ordered before user@.service startup so it is safe from self-notifications. Rough measurements with 3000 mount units: > time systemctl start user@1000 before real 0m1.358s user 0m0.005s sys 0m0.013s after real 0m0.351s user 0m0.008s sys 0m0.010s
- Loading branch information