Diffusion KIO a7d91ea3f0df

Register spawned applications as an independent cgroups

Authored by davidedmundson on Mar 25 2020, 3:27 PM.

Description

Register spawned applications as an independent cgroups

Summary:
Having each application in it's own scope brings numerous advantages:

  • PIDs are very yesteryear, a modern application has a tonne of

processes. We want some sort of logical grouping in ksysguard.
We have a working version of this.

It also can resolve the case of correctly matching the
audio indicator to the correct application in the task manager.
Something that has been proven to not work reliably by tracking parent
PIDs.

  • We can use the cgroup freezer controller on plasma-mobile to suspend

background processes.

  • We want to put things into the correct slice.

Future systemd will split user.slice into 3 subslices, background
services, apps and chrome (with chrome being plasmashell and kwin in our
case). Putting applications in the correct slice will bring pre-bumped
niceness levels.

  • We also can expose cgroup resources limits
  • Things get cleaned up logout without relying on xsmp.

This is analogous to Gnome's recent change:
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/863/diffs

It was also discussed in person at a very-mini meeting at FOSDEM with
both systemd and gnome people.

Task T12678

If a relevant cgroup controller (systemd) is not running, this simply
no-ops without issue.

In addition things are guarded by an environment variable so we don't
introduce any behavioural changes to released Plasma's.


This change is incredibly minimal by launching as normal and then
tagging afterwards. It's a bit of a chicken and egg scenario as we merge
the intended usages of this change.

After things are established we will want to move spawning the
application to be responsiblity of the cgroup controller as transient
services rather than transient scopes. It will be more "technically
correct" and allow even more features such as improved logging.

Test Plan:
Ran app from kickoff, started systemd-cgls
I've been using some variant of this on a private work project for
months
Also ran against pending ksysguard modifications that showed
applications grouped nicely

Reviewers: dfaure

Reviewed By: dfaure

Subscribers: apol, kde-frameworks-devel

Tags: Frameworks

Maniphest Tasks: T12678

Differential Revision: https://phabricator.kde.org/D27883

Details

Committed
davidedmundsonMar 25 2020, 3:27 PM
Reviewer
dfaure
Differential Revision
D27883: Register spawned applications as an independent cgroups
Parents
R241:68f677e234e9: Fix build
Branches
Unknown
Tags
Unknown