cgroup: add new helper that knows which controllers are mounted together

This commit is contained in:
Lennart Poettering 2018-11-15 21:14:54 +01:00
parent 143fadf369
commit c01ef321af
1 changed files with 9 additions and 0 deletions

View File

@ -60,6 +60,15 @@ typedef enum CGroupMask {
_CGROUP_MASK_ALL = CGROUP_CONTROLLER_TO_MASK(_CGROUP_CONTROLLER_MAX) - 1
} CGroupMask;
static inline CGroupMask CGROUP_MASK_EXTEND_JOINED(CGroupMask mask) {
/* We always mount "cpu" and "cpuacct" in the same hierarchy. Hence, when one bit is set also set the other */
if (mask & (CGROUP_MASK_CPU|CGROUP_MASK_CPUACCT))
mask |= (CGROUP_MASK_CPU|CGROUP_MASK_CPUACCT);
return mask;
}
/* Special values for all weight knobs on unified hierarchy */
#define CGROUP_WEIGHT_INVALID ((uint64_t) -1)
#define CGROUP_WEIGHT_MIN UINT64_C(1)