I'm using Ubuntu 20.04 LTS with MATE desktop which doesn't natively support launching desktop UI and window manager in a separate cgroup from the other applications.
Is it possible to run some systemd
specific commands via .xsessionrc
to create nested cgroup
as child of user@${UID}.service
and move selected processes there? I'd prefer something that doesn't require sudo
or root
so that the required commands could be safely executed by the respective user account (with the effective user id $UID
).
Basically I'm looking for real world replacements for following imaginary commands
systemd-cgroup-create --parent "user@${UID}.service" "gui-desktop@${UID}.slice"
systemd-cgroup-move-process --to "gui-desktop@${UID}.slice" $(pgrep --uid $UID marco) $(pgrep --uid $UID mate-panel) $(pgrep --uid $UID mate-session)
systemd-cgroup-modify --set "MemoryMin=1G" --set "IOWeight=1000" "gui-desktop@${UID}.slice"
All I can see is systemd-run
but that only supports starting a single process instead of manipulating already existing processes.
I know that cgclassify
and similar old tools can technically do this given root
acces but systemd
expects that it's the sole source of modifications to the cgroup hierarchy so this would need to be done via systemd
specific commands.