This change causes ilia to use systemd-run to start applications in their own cgroup. This allows specific applications to be killed by systemd-oomd instead of the entire session in out-of-memory situations.
Why this is important
Ubuntu has been using systemd-oomd to handle out-of-memory situations since v22.04. The systemd-oomd documentation recommends starting applications with systems user manager to prevent multiple processes from starting within the same cgroup.
Be aware that if you intend to enable monitoring and actions on user.slice, user-$UID.slice, or their ancestor cgroups, it is highly recommended that your programs be managed by the systemd user manager to prevent running too many processes under the same session scope (and thus avoid a situation where memory intensive tasks trigger systemd-oomd to kill everything under the cgroup). If you're using a desktop environment like GNOME or KDE, it already spawns many session components with the systemd user manager.
Currently applications launched by ilia inherit the cgroup of ilia, which is usually going to be regolith-wayland.service, regolith-x11.service or user@.service (for non systemd based sessions). As per the docs, this means, if any of the processes started by ilia are causing out-of-memory, the entire session (or user) will be killed.
When Fedora migrated to systemd-oomd, they provided the following recommendation to prevent everything from being in the same cgroup.
How will this work if everything is in the same cgroup?
It will not work as systemd-oomd acts on a per-cgroup level. Applications will need to spawn processes into separate cgroups (e.g. with systemd-run) or use a desktop environment (e.g. GNOME, KDE) that does this for them.
Following this guideline, the PR will ensure that all the processes are launched in their own cgroups using systemd-run.
Overview
This change causes ilia to use
systemd-run
to start applications in their own cgroup. This allows specific applications to be killed bysystemd-oomd
instead of the entire session in out-of-memory situations.Why this is important
Ubuntu has been using
systemd-oomd
to handle out-of-memory situations since v22.04. Thesystemd-oomd
documentation recommends starting applications with systems user manager to prevent multiple processes from starting within the same cgroup.Currently applications launched by ilia inherit the cgroup of ilia, which is usually going to be
regolith-wayland.service
,regolith-x11.service
oruser@.service
(for non systemd based sessions). As per the docs, this means, if any of the processes started by ilia are causing out-of-memory, the entire session (or user) will be killed.When Fedora migrated to systemd-oomd, they provided the following recommendation to prevent everything from being in the same cgroup.
Following this guideline, the PR will ensure that all the processes are launched in their own cgroups using
systemd-run
.