I've previously used cgmanager
to group processes in separate cgroups
and adjust memory and CPU limits as needed for each group. However, modern systemd
doesn't want that other processes mess with cgroups
so I guess I would need to configure systemd
to do that instead. (To be exact, Lennart Poettering (the author of systemd) thinks this way.)
I would want to e.g. define following:
- Specify group
desktop
and set minimum reserved RAM for that group to 1 GB, and automatically move my window manager (marco
) and panel process (mate-panel
) to it.
- Specify group
browsers
and set maximum RAM for that group to 20 GB, and automatically move all Firefox, Chrome and Opera processes to that group.
- The limits should be per user: when multiple desktop sessions are running (started via "Switch account" action without logging out previous account), each should have it's own cgroup with the limits above.
The important part is that I want those processes to get into the correct group whenever /usr/bin/marco
or /opt/google/chrome/google-chrome
is executed. That is, this automatic grouping should work even when wrappers such as systemd-run
are not used. In short, no processes should be allowed to escape the cgroup containment.
With cgmanager
this was really easy. You just created one config file and everything was set and it worked really well. However, I've been trying to look for documentation and I cannot figure out how to do the same thing with systemd
alone.