Current solution by storing the list of ulatencyd's own cgroups into
external file is weird and does not address situations where the daemon
gets killed - the file is not written.
I am going to fix this by ulatencyd private cgroup hierarchies mounted
without cgroup subsystems.
Detect and handle foreign cgroups using ulatencyd private cgroup
For every used subsystem the private hierarchy is created in
<CGROUP_ROOT>/ulatencyd/<subsys>, e.g. /sys/fs/cgroup/ulatencyd/cpu.
The hierarchy is mounted:
- without any cgroup controller
- with name "ulatencyd.<subsystem>"
- using the fake device (first column in /proc/mounts) corresponding to
the directory where hierarchy with the real cgroup subsystem controller
is mounted. This way userspace scripts (e.g. ulatency) are able to map
our private hierarchies to the real ones.
Every cgroup directory created/removed by ulatencyd is also created/removed
in the corresponding private hierarchy. Tasks are not moved (mirrored)
inside private hierarchies as not needed for this purpose.