Skip to content

Commit 54bcf63

Browse files
committed
cgroup: Add cgroup_enable option
The upstream addition of the kernel parameter cgroup_disable makes it possible to configure cgroups at boot time. In theory, re-enabling a disabled cgroup is simply a case of removing the relevant cgroup_disable setting, but this is difficult if the setting comes from Device Tree. Re-introduce cgroup_enable as a way around the problem. Signed-off-by: Phil Elwell <[email protected]>
1 parent a08b057 commit 54bcf63

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

kernel/cgroup/cgroup.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6848,6 +6848,39 @@ static int __init cgroup_disable(char *str)
68486848
}
68496849
__setup("cgroup_disable=", cgroup_disable);
68506850

6851+
static int __init cgroup_enable(char *str)
6852+
{
6853+
struct cgroup_subsys *ss;
6854+
char *token;
6855+
int i;
6856+
6857+
while ((token = strsep(&str, ",")) != NULL) {
6858+
if (!*token)
6859+
continue;
6860+
6861+
for_each_subsys(ss, i) {
6862+
if (strcmp(token, ss->name) &&
6863+
strcmp(token, ss->legacy_name))
6864+
continue;
6865+
6866+
static_branch_enable(cgroup_subsys_enabled_key[i]);
6867+
pr_info("Enabling %s control group subsystem\n",
6868+
ss->name);
6869+
}
6870+
6871+
for (i = 0; i < OPT_FEATURE_COUNT; i++) {
6872+
if (strcmp(token, cgroup_opt_feature_names[i]))
6873+
continue;
6874+
cgroup_feature_disable_mask &= ~(1 << i);
6875+
pr_info("Enabling %s control group feature\n",
6876+
cgroup_opt_feature_names[i]);
6877+
break;
6878+
}
6879+
}
6880+
return 1;
6881+
}
6882+
__setup("cgroup_enable=", cgroup_enable);
6883+
68516884
void __init __weak enable_debug_cgroup(void) { }
68526885

68536886
static int __init enable_cgroup_debug(char *str)

0 commit comments

Comments
 (0)