cgroup: bypass and subtree root modes
Subsystems (2)
cover cgroup: bypass and subtree root modes
This patchset introduces new capability to the cgroup v2 core to give more freedom and flexibility to controllers so that they can have their own unique views of the virtual process hierarchies that can best suit thier own use cases without suffering unneeded performance problem.
This patchset is derived from my previous v2 RFC patchset on
https://lkml.org/lkml/2017/5/15/440
cgroup: Major changes to cgroup v2 core
It is on top of Tejun's "cgroup: implement cgroup2 thread mode, v2" and my "cgroup: Make debug controller useful for debugging" patchsets:
https://lkml.org/lkml/2017/6/10/93
https://lkml.org/lkml/2017/6/13/862
Patch 1 relaxes the no internal process constraint to allow internal processes if no non-threaded (resource domain) controllers are enabled.
Patch 2 introduces a new bypass mode (previously called pass-through mode) that allows a controller to be disabled in the current cgroup, but re-enabled again in its children. This is enabled by writing the controller name prefixed with '#' to the "cgroup.controllers" file. A controller can be bypassed only if it is enabled in the parent's subtree_control file.
Patch 3 extends the bypass mode to the "cgroup.subtree_control" file allowing a parent cgroup to enforce all its child cgroups to have a controller in bypass mode.
Patch 4 introduces a new subtree root mode which restricts the number of child cgroups to one and controllers are granted to its child in bypass mode only. This mode is to be used by containers. The cgroup with subtree root mode on will control the resources passed down to its only child which will be the root of the container cgroup hierarchy. Like a real cgroup v2 root, there is no control knobs to tune the resources. Instead, all the tuning will be done in its parent. The container root can enable controllers in its child cgroups to further restrict the distribution of resources if it so desires. Like a real root, the no internal process constraint does not apply to the pseudo root and it can be a mixable root of a mixed threaded tree.
Patch 5 fixes a problem discovered during testing that rapid enabling and disabling of controllers can lead to undesirable errors.
Patch 6 extends the debug controller to expose additional information introduced by this patchset.
Waiman Long (6):
cgroup: Relax the no internal process constraint
cgroup: Enable bypass mode in cgroup v2
cgroup: Allow bypss mode in subtree_control
cgroup: Introduce subtree root mode
cgroup: Skip dying css in cgroup_apply_control_{enable,disable}
cgroup: Make debug controller display bypass and subtree root modes
info
Documentation/cgroup-v2.txt | 194 +++++++++++++++++---- include/linux/cgroup-defs.h | 24 +++ kernel/cgroup/cgroup-internal.h | 12 ++ kernel/cgroup/cgroup.c | 372 ++++++++++++++++++++++++++++++++-------- kernel/cgroup/debug.c | 27 ++- 5 files changed, 512 insertions(+), 117 deletions(-)
Signature · 1 line
1.8.3.1
RFC 1/6 cgroup: Relax the no internal process constraint
The no internal process contraint is rather limiting. The fact that threaded cgroups are exempt from this rule means that the restriction is actually not needed in some cases.
Rather than having threaded cgroups as exceptions, the no internal process contraint is now relaxed to apply only when those resource domain controllers, which are not allowed in a threaded cgroup, are enabled. That will cover the case of threaded cgroups without an explicit exception. This also makes it easier for those controllers that can handle internal process competition to migrate to cgroup v2.
--- Documentation/cgroup-v2.txt | 44 ++++++++++++++++++++++++++++---------------- kernel/cgroup/cgroup.c | 24 +++++++++++++----------- 2 files changed, 41 insertions(+), 27 deletions(-)
Documentation/cgroup-v2.txt +28 -16
@@ -374,15 +374,27 @@ disabled if one or more children have it enabled. 2-4-3. No Internal Process Constraint -Non-root cgroups can only distribute resources to their children when -they don't have any processes of their own. In other words, only -cgroups which don't contain any processes can have controllers enabled -in their "cgroup.subtree_control" files. - -This guarantees that, when a controller is looking at the part of the -hierarchy which has it enabled, processes are always only on the -leaves. This rules out situations where child cgroups compete against -internal processes of the parent. +When a non-root cgroup distributes resources to their children while +having processes of its own, its internal processes will then compete +against its children in term of resource allocation. For some resource +types, that is not a problem and the controllers are able to handle +them correctly. For others, the controllers may not be able to handle +internal process competition correctly. This type of controllers are +called resource domain controllers in this document. + +Internal processes are not allowed on non-root cgroups which has +any one of those resource domain controllers enabled. Currently all +controllers that are allowed in a threaded cgroup will be considered +as a non-resource domain controller and hence will not block internal +processes. In other words, only cgroups which don't contain any +processes can have resource domain controllers enabled in their +"cgroup.subtree_control" files. + +This guarantees that, when a controller is looking at the part of +the hierarchy which has it enabled, processes are always only on the +leaves when resource domain controllers are enabled. This rules out +situations where child cgroups compete against internal processes of +the parent for those controllers that can't handle it properly. The root cgroup is exempt from this restriction. Root contains processes and anonymous resource consumption which can't be associated
@@ -390,13 +402,13 @@ with any other cgroups and requires special treatment from most controllers. How resource consumption in the root cgroup is governed is up to each controller. -Note that the restriction doesn't get in the way if there is no -enabled controller in the cgroup's "cgroup.subtree_control". This is -important as otherwise it wouldn't be possible to create children of a -populated cgroup. To control resource distribution of a cgroup, the -cgroup must create children and transfer all its processes to the -children before enabling controllers in its "cgroup.subtree_control" -file. +Note that the restriction doesn't get in the way if there is no resource +domain controller enabled in the cgroup's "cgroup.subtree_control". +This is important as otherwise it wouldn't be possible to create +children of a populated cgroup. To control resource distribution +of a cgroup, the cgroup must create children and transfer all +its processes to the children before enabling controllers in its +"cgroup.subtree_control" file. 2-5. Delegation
kernel/cgroup/cgroup.c +13 -11
@@ -2297,13 +2297,14 @@ static int cgroup_migrate_execute(struct cgroup_mgctx *mgctx)* @dst_cgrp: destination cgroup to test * * On the default hierarchy, except for the mixable and threaded cgroups, -* subtree_control must be zero for migration destination cgroups with -* tasks so that child cgroups don't compete against tasks. +* subtree_control must not have any !threaded controllers for migration +* cgroups with tasks so that child cgroups don't compete against tasks +* for those !threaded controllers. */ bool cgroup_may_migrate_to (struct cgroup *dst_cgrp) {return !cgroup_on_dfl (dst_cgrp) ||cgroup_is_mixable (dst_cgrp) || -cgroup_is_threaded (dst_cgrp) || !dst_cgrp->subtree_control; + !(dst_cgrp->subtree_control & ~cgrp_dfl_threaded_ss_mask); }/**
@@ -3020,12 +3021,12 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, }/* -* Except for mixable and threaded cgroups, subtree_control must be -* zero for a cgroup with tasks so that child cgroups don't compete -* against tasks. +* Except for mixable cgroups, subtree_control must not contain any +* !threaded controller for a cgroup with tasks so that child cgroups +* don't compete against tasks. */ -if (enable && !cgroup_is_mixable (cgrp) && !cgroup_is_threaded (cgrp) && -cgroup_has_tasks (cgrp)) { +if ((enable & ~cgrp_dfl_threaded_ss_mask) && + !cgroup_is_mixable (cgrp) &&cgroup_has_tasks (cgrp)) { ret = -EBUSY ; goto out_unlock; }
@@ -3086,10 +3087,11 @@ static int cgroup_vet_thread_mode_op(struct cgroup *cgrp, enum thread_mode_op op/* * @cgrp is starting or ending a normal threaded subtree. Make -* sure the subtree is empty and avoid needing implicit domain -* controller migrations. +* sure the subtree has no !threaded controller enabled and avoid +* needing implicit domain controller migrations. */ -if (css_has_online_children (&cgrp->self) || cgrp->subtree_control) +if (css_has_online_children (&cgrp->self) || + (cgrp->subtree_control & ~cgrp_dfl_threaded_ss_mask))return -EBUSY ;/* no partial disable */
Signature · 1 line
1.8.3.1
RFC 2/6 cgroup: Enable bypass mode in cgroup v2
In reply to Waiman LongFor cgroup v1, different controllers can be binded to different cgroup hierarchies optimized for their own use cases. That is not currently the case for cgroup v2 where combining all these controllers into the same hierarchy will probably require more levels than is needed by each individual controller.
By not enabling a controller in a cgroup and its descendants, we can effectively trim the hierarchy as seen by a controller from the leafs up. However, there is currently no way to compress the hierarchy in the intermediate levels.
This patch implements a new bypass mechanism to allow a controller to skip some intermediate levels in a hierarchy and effectively flatten the hierarchy as seen by that controller.
Controllers enabled by the parent's "cgroup.subtree_control" file can now be set into a special bypass mode by writing to the "cgroup.controllers" file with the special '#' prefix attached to the controller name. In that mode, the controller is disabled for that cgroup but it allows its children to have that controller enabled or in bypass mode again. The bypass mode is removed by using the '+' prefix.
With this change, each controller can now have a unique view of their virtual process hierarchy that can be quite different from other controllers. We now have the freedom and flexibility to create the right hierarchy for each controller to suit their own needs without performance loss when compared with cgroup v1.
--- Documentation/cgroup-v2.txt | 98 ++++++++++++++++---- include/linux/cgroup-defs.h | 8 ++ kernel/cgroup/cgroup.c | 211 ++++++++++++++++++++++++++++++++++++-------- 3 files changed, 263 insertions(+), 54 deletions(-)
Documentation/cgroup-v2.txt +83 -15
@@ -323,25 +323,28 @@ both cgroups. 2-4-1. Enabling and Disabling Each cgroup has a "cgroup.controllers" file which lists all -controllers available for the cgroup to enable. +controllers available for the cgroup to enable for its children. # cat cgroup.controllers cpu io memory -No controller is enabled by default. Controllers can be enabled and -disabled by writing to the "cgroup.subtree_control" file. +No controller is enabled by default. Controllers can be +enabled and disabled on the child cgroups by writing to the +"cgroup.subtree_control" file. A '+' prefix enables the controller, +and a '-' prefix disables it. # echo "+cpu +memory -io" > cgroup.subtree_control -Only controllers which are listed in "cgroup.controllers" can be -enabled. When multiple operations are specified as above, either they -all succeed or fail. If multiple operations on the same controller -are specified, the last one is effective. +Only controllers which are listed in "cgroup.controllers" can +be enabled in the "cgroup.subtree_control" file. When multiple +operations are specified as above, either they all succeed or fail. +If multiple operations on the same controller are specified, the last +one is effective. Enabling a controller in a cgroup indicates that the distribution of the target resource across its immediate children will be controlled. -Consider the following sub-hierarchy. The enabled controllers are -listed in parentheses. +Consider the following sub-hierarchy. The enabled controllers in the +"cgroup.subtree_control" file are listed in parentheses. A(cpu,memory) - B(memory) - C() \ D()
@@ -351,6 +354,17 @@ of CPU cycles and memory to its children, in this case, B. As B has "memory" enabled but not "CPU", C and D will compete freely on CPU cycles but their division of memory available to B will be controlled. +By not enabling a controller in a cgroup and its descendants, we can +effectively trim the hierarchy as seen by a controller from the leafs +up. From the perspective of the cpu controller, the hierarchy is: + + A - B|C|D + +From the perspective of the memory controller, the hierarchy becomes: + + A - B - C + \ D + As a controller regulates the distribution of the target resource to the cgroup's children, enabling it creates the controller's interface files in the child cgroups. In the above example, enabling "cpu" on B
@@ -358,7 +372,55 @@ would create the "cpu." prefixed controller interface files in C and D. Likewise, disabling "memory" from B would remove the "memory." prefixed controller interface files from C and D. This means that the controller interface files - anything which doesn't start with -"cgroup." are owned by the parent rather than the cgroup itself. +"cgroup." can be considered to be owned by the parent under this +control scheme. + +Enabling controllers via the "cgroup.subtree_control" file is +relatively coarse-grained. Finer-grained control of the controllers +in a non-root cgroup can be done by writing a controller name with +either a '#' or '+' prefix to its "cgroup.controllers" file directly. + +Writing the special prefix '#' with the controller name +into "cgroup.controllers" is used to mark that controller in +bypass mode. Only controllers that are enabled at the parent's +"cgroup.subtree_control" file can be used. In this mode, the +controller is disabled in the cgroup effectively collapsing it with +its parent from the perspective of that controller. However, it allows +the enablement of that controller in the "cgroup.subtree_control" +file and hence enabled in the child cgroups. The bypass mode can be +disabled by using the '+' prefix to re-enable the controller. + +In the example below, '+' corresponds to an enabled controller and +corresponds to a bypassed controller. + + + # # # + + A - B - C - D - E + \ F + + +In this case, the effective hiearchy is: + + A|B|C|D - E + \ F + +The use of the special '#' prefix allows the users to trim away layers +in the middle of the hierarchy, thus flattening the tree from the +perspective of that particular controller. As a result, different +controllers can have quite different views of their virtual process +hierarchy that can best fit their own needs. + +In the diagram below, the controller name in the parenthesis represents +controller enabled as shown in the "cgroup.controllers" file. + + A(cpu,memory) - B(cpu,#memory) - C() + \ D(memory) + +From the memory controller's perspective, the hierarchy looks like: + + A|B|C - D + +For the CPU controller, the hierarchy is: + + A - B|C|D 2-4-2. Top-down Constraint
@@ -368,8 +430,8 @@ a resource only if the resource has been distributed to it from the parent. This means that all non-root "cgroup.subtree_control" files can only contain controllers which are enabled in the parent's "cgroup.subtree_control" file. A controller can be enabled only if -the parent has the controller enabled and a controller can't be -disabled if one or more children have it enabled. +the parent has the controller enabled ('+' or '#') and a controller +can't be disabled if one or more children have it enabled. 2-4-3. No Internal Process Constraint
@@ -725,11 +787,17 @@ All cgroup core files are prefixed with "cgroup." cgroup.controllers - A read-only space separated values file which exists on all + A read-write space separated values file which exists on all cgroups. - It shows space separated list of all controllers available to - the cgroup. The controllers are not ordered. + When read, it shows space separated list of all controllers + available to the cgroup. The controllers are not ordered. + + Space separated list of controllers prefixed with '+' or '#' + can be written to re-enable or set the controllers in bypass + mode. If a controller appears more than once on the list, + the last one is effective. When multiple re-enable and bypass + operations are specified, either all succeed or all fail. cgroup.subtree_control
include/linux/cgroup-defs.h +8 -0
@@ -289,6 +289,14 @@ struct cgroup {u16 old_subtree_control;u16 old_subtree_ss_mask; +/* +* The bitmasks of subsystems in bypass mode on the current cgroup. +* The bypass mode can only be set if a controller is enabled at +* the parent subtree_control mask. +*/ +u16 bypass_ss_mask; +u16 old_bypass_ss_mask; +/* Private pointers for each registered subsystem */ struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT ];
kernel/cgroup/cgroup.c +172 -39
343 lines not on this page · raw message
Signature · 1 line
1.8.3.1
RFC 3/6 cgroup: Allow bypss mode in subtree_control
In reply to Waiman LongThe special prefix '#' attached to a controller name can now be written into the cgroup.subtree_control file to set that controller in bypass mode in all the child cgroups. The controller will show up in the children's cgroup.controllers file, but the corresponding control knobs will be absent. The child cgroups cannot change the controller states by writing to their cgroup.controllers file at all.
That can be useful for setting up a container where the container root has a parent which enables controllers in bypass mode only. The container root will then behave similar to a real root where controller names show up in cgroup.controllers but the resource control files are absent. If that parent has only one child which is a container root, enabling those controllers in that parent will allow container specific resources to be controlled there without being noticed by the container itself.
--- Documentation/cgroup-v2.txt | 19 ++++++++---- include/linux/cgroup-defs.h | 4 +++ kernel/cgroup/cgroup.c | 70 ++++++++++++++++++++++++++++----------------- 3 files changed, 61 insertions(+), 32 deletions(-)
Documentation/cgroup-v2.txt +13 -6
@@ -335,6 +335,11 @@ and a '-' prefix disables it. # echo "+cpu +memory -io" > cgroup.subtree_control +The special prefix '#' is used to enable bypass mode for that +particular controller on the child cgroups. In the bypass mode, a +controller is disabled in a cgroup, but it can be enabled again in +its child cgroups. + Only controllers which are listed in "cgroup.controllers" can be enabled in the "cgroup.subtree_control" file. When multiple operations are specified as above, either they all succeed or fail.
@@ -808,12 +813,14 @@ All cgroup core files are prefixed with "cgroup." which are enabled to control resource distribution from the cgroup to its children. - Space separated list of controllers prefixed with '+' or '-' - can be written to enable or disable controllers. A controller - name prefixed with '+' enables the controller and '-' - disables. If a controller appears more than once on the list, - the last one is effective. When multiple enable and disable - operations are specified, either all succeed or all fail. + Space separated list of controllers prefixed with '+', '-' + or '#' can be written to enable or disable controllers as + well as setting them into bypass mode. A controller name + prefixed with '+' enables the controller and '-' disables. + The '#' prefix sets the controller into bypass mode. If a + controller appears more than once on the list, the last + one is effective. When multiple operations are specified, + either all succeed or all fail. cgroup.events
include/linux/cgroup-defs.h +4 -0
@@ -283,10 +283,14 @@ struct cgroup {* "cgroup.subtree_control" while ->child_ss_mask is the effective * one which may have more subsystems enabled. Controller knobs * are made available iff it's enabled in ->subtree_control. +* ->subtree_bypass marks those controllers that are set into +* the bypass mode in the child cgroups. */ u16 subtree_control; +u16 subtree_bypass;u16 subtree_ss_mask;u16 old_subtree_control; +u16 old_subtree_bypass;u16 old_subtree_ss_mask;/*
kernel/cgroup/cgroup.c +44 -26
220 lines not on this page · raw message
Signature · 1 line
1.8.3.1
RFC 4/6 cgroup: Introduce subtree root mode
In reply to Waiman LongSubtree root mode is a new cgroup mode which applies the following restrictions when turned on:
1) Controllers are only allowed to be passed to the children in bypass mode except those with the "enable_on_root" flag on.
2) Only 1 child cgroup is allowed.
That lone child can be used as the pseudo root of a container cgroup hierarchy. All the resources, if controlled, are in the parent cgroup. There will be no control knobs in the child. That makes it look and feel like a root.
That pseudo root is also considered to be mixable and so can become root of a mixed threaded subtree. The no internal process constraint also does not apply.
The subtree root mode and thread mode are mutually exclusive.
The subtree root mode is enabled by doing:
# echo root > cgroup.subtree_control
It is disabled by:
# echo nonroot > cgroup.subtree_control
--- Documentation/cgroup-v2.txt | 43 +++++++++++++++++++---- include/linux/cgroup-defs.h | 12 +++++++ kernel/cgroup/cgroup.c | 86 +++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 129 insertions(+), 12 deletions(-)
Documentation/cgroup-v2.txt +37 -6
@@ -23,7 +23,8 @@ CONTENTS 2-4. Controlling Controllers 2-4-1. Enabling and Disabling 2-4-2. Top-down Constraint - 2-4-3. No Internal Process Constraint + 2-4-3. Subtree root mode + 2-4-4. No Internal Process Constraint 2-5. Delegation 2-5-1. Model of Delegation 2-5-2. Delegation Containment
@@ -439,7 +440,33 @@ the parent has the controller enabled ('+' or '#') and a controller can't be disabled if one or more children have it enabled. -2-4-3. No Internal Process Constraint +2-4-3. Subtree root mode + +Subtree root mode is a special cgroup mode that restricts the passing +of most controllers in bypass mode only. Only controllers that +have the special "enabled_on_root" flag on can be directly enabled. +It also allows only one child cgroup to be created. That child cgroup +can be used as the pseudo root of a container cgroup hierarchy. + +This pseudo root will look and feel like a root cgroup as resources +that are not controllable in a real root will not be controllable in +the pseudo root. Instead, those resources can be controlled in the +parent of the pseudo root. + +The pseudo root can be the root of a mixed threaded subtree, and the +no internal process contraint does not apply. Subtree root mode and +thread mode are mutually exclusive. + +Subtree root is enabled by writing "root" to "cgroup.subtree_control". + + # echo root > cgroup.subtree_control + +It is disabled by writing "nonroot" to "cgroup.subtree_control". + + # echo nonroot > cgroup.subtree_control + + +2-4-4. No Internal Process Constraint When a non-root cgroup distributes resources to their children while having processes of its own, its internal processes will then compete
@@ -817,10 +844,14 @@ All cgroup core files are prefixed with "cgroup." or '#' can be written to enable or disable controllers as well as setting them into bypass mode. A controller name prefixed with '+' enables the controller and '-' disables. - The '#' prefix sets the controller into bypass mode. If a - controller appears more than once on the list, the last - one is effective. When multiple operations are specified, - either all succeed or all fail. + The '#' prefix sets the controller into bypass mode. + + The special keywords "root" and "nonroot" can be written to + enable and disable the subtree root mode respectively. + + If a controller or a keyword appears more than once on the + list, the last one is effective. When multiple operations + are specified, either all succeed or all fail. cgroup.events
include/linux/cgroup-defs.h +12 -0
@@ -61,6 +61,12 @@ enum {* specified at mount time and thus is implemented here. */ CGRP_CPUSET_CLONE_CHILDREN , +/* +* Enforce passing controllers in bypass mode and one child only. +* This child becomes a pseudo root that can serve as the root of +* a container. +*/ + CGRP_SUBTREE_ROOT_MODE, };/* cgroup_root->flags */
@@ -529,6 +535,12 @@ struct cgroup_subsys { bool threaded:1;/* +* If %true, the subsystem can be enabled on root or pseudo root on +* the default heirarchy. +*/ + bool enabled_on_root:1; + +/* * If %false, this subsystem is properly hierarchical - * configuration, resource accounting and restriction on a parent * cgroup cover those of its children. If %true, hierarchy support
kernel/cgroup/cgroup.c +80 -6
164 lines not on this page · raw message
Signature · 1 line
1.8.3.1
RFC 5/6 cgroup: Skip dying css in cgroup_apply_control_{enable,disable}
In reply to Waiman LongWhile constantly turning on and off controllers, it is possible to trigger the dying CSS warnings in cgroup_apply_control_enable() and cgroup_apply_control_disable(). The current code, however, proceeds after the warning leading to other secondary warnings and maybe even data corruption, like
cgroup: cgroup_addrm_files: failed to add current, err=-17
To avoid the secondary errors, the dying CSS is now ignored or skipped so as not to cause other problem.
--- kernel/cgroup/cgroup.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
kernel/cgroup/cgroup.c +15 -5
@@ -2846,12 +2846,24 @@ static int cgroup_apply_control_enable(struct cgroup *cgrp)for_each_subsys (ss, ssid) {struct cgroup_subsys_state *css =cgroup_css (dsct, ss); -WARN_ON_ONCE (css &&percpu_ref_is_dying (&css->refcnt)); -if (!(cgroup_ss_mask (dsct, false) & (1 << ss->id)) || (dsct->bypass_ss_mask & (1 << ss->id)))continue ; +/* +* If the css is dying, we will just skip it after +* warning. +*/ +if (css && (css->flags &CSS_DYING )) { +char name[NAME_MAX +1 ]; + +cgroup_name (cgrp, name,NAME_MAX ); +pr_warn ("%s: %s css of cgroup %s is dying!\n" , + __func__, ss->name, name); +WARN_ON_ONCE (1 ); +continue ; + } +if (!css) { css =css_create (dsct, ss);if (IS_ERR (css))
@@ -2893,9 +2905,7 @@ static void cgroup_apply_control_disable(struct cgroup *cgrp)for_each_subsys (ss, ssid) {struct cgroup_subsys_state *css =cgroup_css (dsct, ss); -WARN_ON_ONCE (css &&percpu_ref_is_dying (&css->refcnt)); - -if (!css) +if (!css || (css->flags &CSS_DYING ))continue ; if (css->parent &&
Signature · 1 line
1.8.3.1
RFC 6/6 cgroup: Make debug controller display bypass and subtree root modes info
In reply to Waiman LongThis patch enables the debug controller to display the new bypass mode and subtree root mode information.
--- kernel/cgroup/cgroup-internal.h | 12 ++++++++++++ kernel/cgroup/cgroup.c | 9 --------- kernel/cgroup/debug.c | 27 ++++++++++++++++++++------- 3 files changed, 32 insertions(+), 16 deletions(-)
kernel/cgroup/cgroup-internal.h +12 -0
@@ -151,6 +151,18 @@ static inline void get_css_set(struct css_set *cset)refcount_inc (&cset->refcount); } +/* +* Return the cgroup parent. +*/ +static inline struct cgroup *cgroup_parent (struct cgroup *cgrp) +{ +struct cgroup_subsys_state *parent_css = cgrp->self.parent; + +if (parent_css) + return container_of(parent_css, struct cgroup, self); +return NULL ; +} +bool cgroup_ssid_enabled (int ssid);bool cgroup_on_dfl (const struct cgroup *cgrp);
kernel/cgroup/cgroup.c +0 -9
@@ -322,15 +322,6 @@ static void cgroup_idr_remove(struct idr *idr, int id)spin_unlock_bh (&cgroup_idr_lock); } -static struct cgroup *cgroup_parent (struct cgroup *cgrp) -{ -struct cgroup_subsys_state *parent_css = cgrp->self.parent; - -if (parent_css) - return container_of(parent_css, struct cgroup, self); -return NULL ; -} -/* is @cgrp threaded? regardless of mixed / root / member? */ static bool cgroup_is_threaded (struct cgroup *cgrp) {
kernel/cgroup/debug.c +20 -7
@@ -198,6 +198,7 @@ static int cgroup_css_links_read(struct seq_file *seq, void *v)static int cgroup_subsys_states_read (struct seq_file *seq,void *v) {struct cgroup *cgrp =seq_css (seq)->cgroup; +struct cgroup *parent =cgroup_parent (cgrp);struct cgroup_subsys *ss;struct cgroup_subsys_state *css;char pbuf[16 ];
@@ -206,9 +207,16 @@ static int cgroup_subsys_states_read(struct seq_file *seq, void *v)mutex_lock (&cgroup_mutex);for_each_subsys (ss, i) { css =rcu_dereference_check (cgrp->subsys[ss->id], true); -if (!css) +if (!css) { +u16 bypass = cgrp->bypass_ss_mask; + +if (parent) + bypass |= parent->subtree_bypass; +if (bypass & (1 << ss->id)) +seq_printf (seq,"%2d: %-4s\t- [Bypass]\n" , + ss->id, ss->name);continue ; - + } pbuf[0 ] ='\0' ;/* Show the parent CSS if applicable*/
@@ -234,6 +242,8 @@ static int cgroup_masks_read(struct seq_file *seq, void *v) } mask_list[] = { { &cgrp->subtree_control, "subtree_control" }, { &cgrp->subtree_ss_mask, "subtree_ss_mask" }, + { &cgrp->subtree_bypass, "subtree_bypass" }, + { &cgrp->bypass_ss_mask, "bypass_ss_mask" }, }; mutex_lock(&cgroup_mutex);
@@ -255,6 +265,8 @@ static int cgroup_masks_read(struct seq_file *seq, void *v)if (cgrp->proc_cgrp)seq_printf (seq,"thread mode : %s\n" , (cgrp->proc_cgrp == cgrp) ?"root" :"threaded" ); +if (test_bit (CGRP_SUBTREE_ROOT_MODE , &cgrp->flags)) +seq_puts (seq,"subtree root mode: on\n" );mutex_unlock (&cgroup_mutex);return 0 ;
@@ -314,11 +326,12 @@ static u64 releasable_read(struct cgroup_subsys_state *css, struct cftype *cft) };struct cgroup_subsys debug_cgrp_subsys = { - .css_alloc = debug_css_alloc, - .css_free = debug_css_free, - .legacy_cftypes = debug_files, - .dfl_cftypes = debug_files, - .threaded = true, + .css_alloc = debug_css_alloc, + .css_free = debug_css_free, + .legacy_cftypes = debug_files, + .dfl_cftypes = debug_files, + .threaded = true, + .enabled_on_root = true, };/*
Signature · 1 line
1.8.3.1
Tejun Heo
maintainerRe: [RFC PATCH-cgroup 1/6] cgroup: Relax the no internal process constraint
In reply to Waiman LongHello, Waiman.
Quoted 5 lines · Waiman Long
2-4-3. No Internal Process Constraint
Documentation/cgroup-v2.txt +3
-0+When a non-root cgroup distributes resources to their children while +having processes of its own, its internal processes will then compete +against its children in term of resource allocation. For some resource
Documentation/cgroup-v2.txt disabled if one or more children have it enabled. · line 389
Quoted 10 lines
Documentation/cgroup-v2.txt +10
-0+types, that is not a problem and the controllers are able to handle +them correctly. For others, the controllers may not be able to handle +internal process competition correctly. This type of controllers are +called resource domain controllers in this document. + +Internal processes are not allowed on non-root cgroups which has +any one of those resource domain controllers enabled. Currently all +controllers that are allowed in a threaded cgroup will be considered +as a non-resource domain controller and hence will not block internal +processes. In other words, only cgroups which don't contain any
This isn't on this patch but I'm not sure this is a good way to define resource domain controllers. We probably should first define resource domains and walk our way in to the accompanying restrictions and then the distinction between the controller types.
...
Documentation/cgroup-v2.txt with any other cgroups and requires special treatment from most · line 411
Quoted 7 lines
Documentation/cgroup-v2.txt +7
-0+Note that the restriction doesn't get in the way if there is no resource +domain controller enabled in the cgroup's "cgroup.subtree_control". +This is important as otherwise it wouldn't be possible to create +children of a populated cgroup. To control resource distribution +of a cgroup, the cgroup must create children and transfer all +its processes to the children before enabling controllers in its +"cgroup.subtree_control" file.
What happens when we add domain handling to CPU so that it is both a domain and resource controller? Even if that somehow can be resolved, wouldn't that come with a rather surprising userland behavior changes? Also, I'm not sure what we're achieving by doing this. It doesn't really relax the restriction. It just turns it off implicitly when certain conditions are met, which doesn't really allow any real capabilities and at least to me the behaviors feel more subtle and complicated than before.
Thanks.
Signature · 1 line
tejun
Tejun Heo
maintainerRe: [RFC PATCH-cgroup 2/6] cgroup: Enable bypass mode in cgroup v2
In reply to Waiman LongHello, Waiman.
Let's first talk about and make sense of high level semantics.
Documentation/cgroup-v2.txt would create the "cpu." prefixed controller interface files in C and · line 403
Quoted 11 lines · Waiman Long
Documentation/cgroup-v2.txt +11
-0+In the example below, '+' corresponds to an enabled controller and +corresponds to a bypassed controller. + + + # # # + + A - B - C - D - E + \ F + + +In this case, the effective hiearchy is: + + A|B|C|D - E + \ F
I think that this definitely has potential. While different controllers may see differently abbreviated versions of the tree, they can still be mapped to the same hierarchy and we can implement cross-controller operations in a meaningful way, I think; however, it does make some things really weird.
In the above example, how would A's resources be distributed. Let's say the resource knob in question is memory.high. Because from memory controller's point of view A|B|C|D are all bunched up and have E and F as children, memory.high resource knobs on E and F would control how A's memory gets distributed, right?
So, once a parent skips a controller with #, you can only determine how its resources are actually distributed by scanning the entire subtree to determine the span of '#' on the controller and any sort of delegation - whether implicit or explicit - wouldn't be possible in the middle, right?
Can you please think of / explain how this would work with delegation? Making things clear with delegation is really helpful because it can serve as the canary for the usual hierarchical operations.
Thanks.
Signature · 1 line
tejun
Re: [RFC PATCH-cgroup 1/6] cgroup: Relax the no internal process constraint
In reply to Tejun HeoQuoted 14 lines · Tejun Heo
Hello, Waiman.
Quoted 11 lines · Waiman Long
2-4-3. No Internal Process Constraint
Documentation/cgroup-v2.txt +9
-0+When a non-root cgroup distributes resources to their children while +having processes of its own, its internal processes will then compete +against its children in term of resource allocation. For some resource +types, that is not a problem and the controllers are able to handle +them correctly. For others, the controllers may not be able to handle +internal process competition correctly. This type of controllers are +called resource domain controllers in this document. + +Internal processes are not allowed on non-root cgroups which has
Quoted 8 lines
Documentation/cgroup-v2.txt disabled if one or more children have it enabled. · line 389
Quoted 4 lines
Documentation/cgroup-v2.txt +4
-0+any one of those resource domain controllers enabled. Currently all +controllers that are allowed in a threaded cgroup will be considered +as a non-resource domain controller and hence will not block internal +processes. In other words, only cgroups which don't contain anyThis isn't on this patch but I'm not sure this is a good way to define resource domain controllers. We probably should first define resource domains and walk our way in to the accompanying restrictions and then the distinction between the controller types.
This patch essentially allows internal process when non of the resource domain controllers are enabled in the sense that they are activated by the subtree_control file of the parent. I do agree that we should probably define resource domain as a separate topic in this document. It is true that a resource domain controller is not technically equivalent to the !threaded controller, but this is the best that we have unless we introduce another controller attribute for resource domain. I have tried to do that in some of my past patches. I think PeterZ had suggested too.
The main purpose to not make thread mode special for internal process handling. Instead, internal processes are allowed because no resource domain controllers are enabled whether or not thread mode is enabled or not. I think that is more consistent than treating thread mode as special.
Quoted 17 lines
...
Documentation/cgroup-v2.txt with any other cgroups and requires special treatment from most · line 411
Quoted 7 lines
Documentation/cgroup-v2.txt +7
-0+Note that the restriction doesn't get in the way if there is no resource +domain controller enabled in the cgroup's "cgroup.subtree_control". +This is important as otherwise it wouldn't be possible to create +children of a populated cgroup. To control resource distribution +of a cgroup, the cgroup must create children and transfer all +its processes to the children before enabling controllers in its +"cgroup.subtree_control" file.What happens when we add domain handling to CPU so that it is both a domain and resource controller? Even if that somehow can be resolved, wouldn't that come with a rather surprising userland behavior changes? Also, I'm not sure what we're achieving by doing this. It doesn't really relax the restriction. It just turns it off implicitly when certain conditions are met, which doesn't really allow any real capabilities and at least to me the behaviors feel more subtle and complicated than before.
Quoted 1 line
Thanks.
I think CPU isn't a good example for that.
Another alternative is to treat no internal process as a controller attribute. Then we don't need to worry about this intricate question and let the controllers decide if they will allow internal processes.
Cheers,
Longman
Tejun Heo
maintainerRe: [RFC PATCH-cgroup 4/6] cgroup: Introduce subtree root mode
In reply to Waiman LongHello, Waiman.
Quoted 11 lines · Waiman Long
Subtree root mode is a new cgroup mode which applies the following restrictions when turned on:
1) Controllers are only allowed to be passed to the children in bypass mode except those with the "
enable_on_root" flag on.
2) Only 1 child cgroup is allowed.That lone child can be used as the pseudo root of a container cgroup hierarchy. All the resources, if controlled, are in the parent cgroup. There will be no control knobs in the child. That makes it look and feel like a root.
I'm not sure not having the control files in the child makes that much difference.
Quoted 3 lines
That pseudo root is also considered to be mixable and so can become root of a mixed threaded subtree. The no internal process constraint also does not apply.
Heh, you can't just declare a non-root cgroup to be a mixed root but if you're special casing this and making the kernel play a masquerade with special node, you can make cgroup provide a mixed root while hosting the internal processes in a dedicated leaf cgroup which isn't visible to the nested root, right?
It's all a game of masquerading tho and doesn't actually enable anything which isn't possible now. This would definitely be useful for testing.
Thanks.
Signature · 1 line
tejun
Tejun Heo
maintainerRe: [RFC PATCH-cgroup 1/6] cgroup: Relax the no internal process constraint
In reply to Waiman LongHello,
Quoted 10 lines · Waiman Long
Quoted 8 lines
What happens when we add domain handling to CPU so that it is both a domain and resource controller? Even if that somehow can be resolved, wouldn't that come with a rather surprising userland behavior changes? Also, I'm not sure what we're achieving by doing this. It doesn't really relax the restriction. It just turns it off implicitly when certain conditions are met, which doesn't really allow any real capabilities and at least to me the behaviors feel more subtle and complicated than before.
I think CPU isn't a good example for that.
Can you please elaborate?
Quoted 3 lines
Another alternative is to treat no internal process as a controller attribute. Then we don't need to worry about this intricate question and let the controllers decide if they will allow internal processes.
Isn't that what "threaded" is?
Thanks.
Signature · 1 line
tejun
Tejun Heo
maintainerRe: [RFC PATCH-cgroup 5/6] cgroup: Skip dying css in cgroup_apply_control_{enable,disable}
In reply to Waiman LongHello,
Quoted 33 lines · Waiman Long
While constantly turning on and off controllers, it is possible to trigger the dying CSS warnings in
cgroup_apply_control_enable()andcgroup_apply_control_disable(). The current code, however, proceeds after the warning leading to other secondary warnings and maybe even data corruption, likecgroup:
cgroup_addrm_files: failed to add current, err=-17To avoid the secondary errors, the dying CSS is now ignored or skipped so as not to cause other problem.
Signed-off-by Waiman Long <[email protected]>--- kernel/cgroup/cgroup.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)kernel/cgroup/cgroup.c +3
-2@@ -2846,12 +2846,24 @@ static int cgroup_apply_control_enable(struct cgroup *cgrp)for_each_subsys (ss, ssid) {struct cgroup_subsys_state *css =cgroup_css (dsct, ss); -WARN_ON_ONCE (css &&percpu_ref_is_dying (&css->refcnt)); -if (!(cgroup_ss_mask (dsct, false) & (1 << ss->id)) || (dsct->bypass_ss_mask & (1 << ss->id)))continue ; +/* +* If the css is dying, we will just skip it after +* warning.
kernel/cgroup/cgroup.c static int cgroup_apply_control_enable(struct cgroup *cgrp) · line 2865
Quoted 10 lines
kernel/cgroup/cgroup.c +10
-0+*/ +if (css && (css->flags &CSS_DYING )) { +char name[NAME_MAX +1 ]; + +cgroup_name (cgrp, name,NAME_MAX ); +pr_warn ("%s: %s css of cgroup %s is dying!\n" , + __func__, ss->name, name); +WARN_ON_ONCE (1 ); +continue ; + }
Can you trigger this without your patches because this triggering means that the code screwed up before it reached this point. We should be fixing that bug rather than masking it up here.
Thanks.
Signature · 1 line
tejun
Re: [RFC PATCH-cgroup 1/6] cgroup: Relax the no internal process constraint
In reply to Tejun HeoQuoted 11 lines · Tejun Heo
Hello,
Quoted 8 lines · Waiman Long
Quoted 8 lines
What happens when we add domain handling to CPU so that it is both a domain and resource controller? Even if that somehow can be resolved, wouldn't that come with a rather surprising userland behavior changes? Also, I'm not sure what we're achieving by doing this. It doesn't really relax the restriction. It just turns it off implicitly when certain conditions are met, which doesn't really allow any real capabilities and at least to me the behaviors feel more subtle and complicated than before.
Quoted 2 lines
Quoted 1 line
I think CPU isn't a good example for that.
Can you please elaborate?
CPU is probably the most prominent controller where deep hierarchy has a performance cost. So I can't envision that it will forbid internal process competition.
Quoted 5 lines
Quoted 3 lines
Another alternative is to treat no internal process as a controller attribute. Then we don't need to worry about this intricate question and let the controllers decide if they will allow internal processes.
Isn't that what "threaded" is?
That is exactly what this patch intends to do. However, you raised concern that threaded may not be equivalent to the need of allowing internal process. That is why I propose that. If your concern is only about the documentation change, we can certainly fix that.
Cheers,
Longman
Re: [RFC PATCH-cgroup 5/6] cgroup: Skip dying css in cgroup_apply_control_{enable,disable}
In reply to Tejun HeoQuoted 50 lines · Tejun Heo
Hello,
Quoted 33 lines · Waiman Long
While constantly turning on and off controllers, it is possible to trigger the dying CSS warnings in
cgroup_apply_control_enable()andcgroup_apply_control_disable(). The current code, however, proceeds after the warning leading to other secondary warnings and maybe even data corruption, likecgroup:
cgroup_addrm_files: failed to add current, err=-17To avoid the secondary errors, the dying CSS is now ignored or skipped so as not to cause other problem.
Signed-off-by Waiman Long <[email protected]>--- kernel/cgroup/cgroup.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)kernel/cgroup/cgroup.c +3
-2@@ -2846,12 +2846,24 @@ static int cgroup_apply_control_enable(struct cgroup *cgrp)for_each_subsys (ss, ssid) {struct cgroup_subsys_state *css =cgroup_css (dsct, ss); -WARN_ON_ONCE (css &&percpu_ref_is_dying (&css->refcnt)); -if (!(cgroup_ss_mask (dsct, false) & (1 << ss->id)) || (dsct->bypass_ss_mask & (1 << ss->id)))continue ; +/* +* If the css is dying, we will just skip it after +* warning. kernel/cgroup/cgroup.c static int cgroup_apply_control_enable(struct cgroup *cgrp) · line 2865
Quoted 10 lines
kernel/cgroup/cgroup.c +10
-0+*/ +if (css && (css->flags &CSS_DYING )) { +char name[NAME_MAX +1 ]; + +cgroup_name (cgrp, name,NAME_MAX ); +pr_warn ("%s: %s css of cgroup %s is dying!\n" , + __func__, ss->name, name); +WARN_ON_ONCE (1 ); +continue ; + }Can you trigger this without your patches because this triggering means that the code screwed up before it reached this point. We should be fixing that bug rather than masking it up here.
Quoted 2 lines
Thanks.
I will try to reproduce it without my patch.
I do think that it can happen with existing code because CSS killing is asynchronous, I think. So the command can complete before the CSS is actually gone. If the next command to reactivate it happens fast enough, we can trigger that. When I added more checking to my test script essentially increasing the latency between successive tests, I couldn't trigger it anymore.
Cheers,
Longman
Tejun Heo
maintainerRe: [RFC PATCH-cgroup 1/6] cgroup: Relax the no internal process constraint
In reply to Waiman LongHey,
Quoted 6 lines · Waiman Long
Quoted 2 lines
Quoted 1 line
I think CPU isn't a good example for that.
Can you please elaborate?
CPU is probably the most prominent controller where deep hierarchy has a performance cost. So I can't envision that it will forbid internal process competition.
I think there's a fundamental misunderstanding here. The internal competion thing is about how to account for resource consumptions which aren't tied to specific processes or tasks. Thread mode allows building sub-hierarchy beyond the domain point while still keeping the domain at the root of the thread subtree. It is true that as currently implemented, CPU controller has performance issues for some workloads even with a moderate level of nesting (and quite a bit of other artifacts from nesting too); however, supporting control of anonymous resources or not is an orthogonal issue. People can enable thread mode at the root if that's applicable to the workload at hand but you can't change what the basic topology means because a controller has performance overhead.
Quoted 9 lines
Quoted 4 lines
Quoted 3 lines
Another alternative is to treat no internal process as a controller attribute. Then we don't need to worry about this intricate question and let the controllers decide if they will allow internal processes.
Isn't that what "threaded" is?
That is exactly what this patch intends to do. However, you raised concern that threaded may not be equivalent to the need of allowing internal process. That is why I propose that. If your concern is only about the documentation change, we can certainly fix that.
I'm really lost on what this actually achieves. Can we please first talk about what you're trying to enable? Let's talk about features and capabilities first because it feels like most of the changes in this patchset lack them and we seem to be talking past each other.
Thanks.
Signature · 1 line
tejun
Tejun Heo
maintainerRe: [RFC PATCH-cgroup 5/6] cgroup: Skip dying css in cgroup_apply_control_{enable,disable}
In reply to Waiman LongHello,
Quoted 6 lines · Waiman Long
I do think that it can happen with existing code because CSS killing is asynchronous, I think. So the command can complete before the CSS is actually gone. If the next command to reactivate it happens fast enough, we can trigger that. When I added more checking to my test script essentially increasing the latency between successive tests, I couldn't trigger it anymore.
While disabling is asynchronous, there's a flushing logic before starting reenabling things, so the existing code shouldn't trigger that condition. But then there's should and the reality. :)
Thanks.
Signature · 1 line
tejun
Re: [RFC PATCH-cgroup 5/6] cgroup: Skip dying css in cgroup_apply_control_{enable,disable}
Quoted 9 lines · Tejun Heo
Hello,
Quoted 6 lines · Waiman Long
I do think that it can happen with existing code because CSS killing is asynchronous, I think. So the command can complete before the CSS is actually gone. If the next command to reactivate it happens fast enough, we can trigger that. When I added more checking to my test script essentially increasing the latency between successive tests, I couldn't trigger it anymore.
Quoted 6 lines
While disabling is asynchronous, there's a flushing logic before starting reenabling things, so the existing code shouldn't trigger that condition. But then there's should and the reality. :)
Thanks.
I actually got errors from cgroup_addrm_files() complaining about creating existing sysfs files because of the css_populate_dir() call when the css was dying but not gone yet. I added code in the patch just to sidestep that. Maybe I should just force the call to css_create() when the old one is dying to see if that will work out.
Cheers,
Longman
Re: [RFC PATCH-cgroup 2/6] cgroup: Enable bypass mode in cgroup v2
In reply to Tejun HeoQuoted 22 lines · Tejun Heo
Hello, Waiman.
Let's first talk about and make sense of high level semantics.
Documentation/cgroup-v2.txt would create the "cpu." prefixed controller interface files in C and · line 403
Quoted 11 lines · Waiman Long
Documentation/cgroup-v2.txt +11
-0+In the example below, '+' corresponds to an enabled controller and +corresponds to a bypassed controller. + + + # # # + + A - B - C - D - E + \ F + + +In this case, the effective hiearchy is: + + A|B|C|D - E + \ FI think that this definitely has potential. While different controllers may see differently abbreviated versions of the tree, they can still be mapped to the same hierarchy and we can implement cross-controller operations in a meaningful way, I think; however, it does make some things really weird.
Quoted 5 lines
In the above example, how would A's resources be distributed. Let's say the resource knob in question is memory.high. Because from memory controller's point of view A|B|C|D are all bunched up and have E and F as children, memory.high resource knobs on E and F would control how A's memory gets distributed, right?
That is right.
Quoted 5 lines
So, once a parent skips a controller with #, you can only determine how its resources are actually distributed by scanning the entire subtree to determine the span of '#' on the controller and any sort of delegation - whether implicit or explicit - wouldn't be possible in the middle, right?
That is right, too.
Quoted 3 lines
Can you please think of / explain how this would work with delegation? Making things clear with delegation is really helpful because it can serve as the canary for the usual hierarchical operations.
+ # +
A - B - C
\ D +
In term of delegation story, I would say that for the above configuration, the parent A can delegate 5 units of resources to B. B, upon finding out it has 5 units of resources, may decide to take itself out of the picture (bypass itself) and delegate, say, 2 units to C and 3 units to D assuming that B has no internal process.
Of course, B can decide to ignore the rules, bypass itself and add internal process to compete with other children of A. So we can make "cgroup.controllers" non-writable to B if we don't want any controllers to be bypassed.
As a side note, I have another delegation story for enabling bypass mode in subtree_control. A parent can activate a controller in bypass mode to signal that it has delegated the authority to enable a controller to its children. A child can then activate a controller by writing '+' to its cgroup.controllers (not implemented yet). In this scenario, the child own the control knobs, not the parent. That can be useful for controllers that deal with ID or membership like devices, freezer, perf_event or even cpusets. You may not want to have separate IDs for all the nodes in the hierarchy, but for those who need a different ID, they can choose to do that. In fact, I am thinking if it may be useful to define a bypass_on_dfl attribute that work like implicit_on_dfl so that we don't need to explicitly set those controllers in bypass mode.
Cheers,
Longman
Re: [RFC PATCH-cgroup 4/6] cgroup: Introduce subtree root mode
In reply to Tejun HeoQuoted 10 lines · Tejun Heo
Hello, Waiman.
Quoted 7 lines · Waiman Long
Subtree root mode is a new cgroup mode which applies the following restrictions when turned on:
1) Controllers are only allowed to be passed to the children in bypass mode except those with the "
enable_on_root" flag on.
2) Only 1 child cgroup is allowed.
Quoted 6 lines
Quoted 4 lines
That lone child can be used as the pseudo root of a container cgroup hierarchy. All the resources, if controlled, are in the parent cgroup. There will be no control knobs in the child. That makes it look and feel like a root.
I'm not sure not having the control files in the child makes that much difference.
It is more a look and feel thing than being useful. The sole purpose is to make the container root looks like a real root as much as possible.
Quoted 8 lines
Quoted 3 lines
That pseudo root is also considered to be mixable and so can become root of a mixed threaded subtree. The no internal process constraint also does not apply.
Heh, you can't just declare a non-root cgroup to be a mixed root but if you're special casing this and making the kernel play a masquerade with special node, you can make cgroup provide a mixed root while hosting the internal processes in a dedicated leaf cgroup which isn't visible to the nested root, right?
That is true.
Quoted 3 lines
It's all a game of masquerading tho and doesn't actually enable anything which isn't possible now. This would definitely be useful for testing.
You are right about that. As mentioned in another email, having bypass mode in subtree_control is useful, I think. The concept of subtree root mode, however, is more toward satisfying PeterZ's idea of container invariant. I won't mind leaving it out if others have no objection to that.
Cheers,
Longman