cgroup: fine tune when to apply cgroup attributes to the root cgroup
authorLennart Poettering <lennart@poettering.net>
Tue, 20 Nov 2018 22:05:12 +0000 (23:05 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 23 Nov 2018 11:24:37 +0000 (12:24 +0100)
commit52fecf20b9269f4675226a8e600cac0bad0539ff
treee87987c7cbf2caf428d74b5a7cec51fb687d3b61
parent589a5f7a389e586bab065dbc1700c96dd5a9a967
cgroup: fine tune when to apply cgroup attributes to the root cgroup

Let's tweak when precisely to apply cgroup attributes on the root
cgroup.

With this we now follow the following rules:

1. On cgroupsv2 we never apply any regular cgroups to the host root,
   since the attributes generally do not exist there.

2. On cgroupsv1 we do not apply any "weight" or "shares" style
   attributes to the host root cgroup, since they don't make much sense
   on the top level where there's only one group, hence no need to
   compare weights against each other. The other attributes are applied
   to the host root cgroup however.

3. In any case we don't apply attributes to the root of container
   environments (and --user roots), under the assumption that this is
   managed by the manager further up. (Note that on cgroupsv2 this is
   even enforced by the kernel)

4. BPF pseudo-attributes are applied in all cases (since we can have as
   many of them as we want)
src/core/cgroup.c