@@ -6081,6 +6081,9 @@ int __init cgroup_init_early(void)
6081
6081
return 0 ;
6082
6082
}
6083
6083
6084
+ static u16 cgroup_enable_mask __initdata ;
6085
+ static int __init cgroup_disable (char * str );
6086
+
6084
6087
/**
6085
6088
* cgroup_init - cgroup initialization
6086
6089
*
@@ -6114,6 +6117,12 @@ int __init cgroup_init(void)
6114
6117
6115
6118
cgroup_unlock ();
6116
6119
6120
+ /*
6121
+ * Apply an implicit disable, knowing that an explicit enable will
6122
+ * prevent if from doing anything.
6123
+ */
6124
+ cgroup_disable ("memory" );
6125
+
6117
6126
for_each_subsys (ss , ssid ) {
6118
6127
if (ss -> early_init ) {
6119
6128
struct cgroup_subsys_state * css =
@@ -6760,6 +6769,10 @@ static int __init cgroup_disable(char *str)
6760
6769
strcmp (token , ss -> legacy_name ))
6761
6770
continue ;
6762
6771
6772
+ /* An explicit cgroup_enable overrides a disable */
6773
+ if (cgroup_enable_mask & (1 << i ))
6774
+ continue ;
6775
+
6763
6776
static_branch_disable (cgroup_subsys_enabled_key [i ]);
6764
6777
pr_info ("Disabling %s control group subsystem\n" ,
6765
6778
ss -> name );
@@ -6778,6 +6791,31 @@ static int __init cgroup_disable(char *str)
6778
6791
}
6779
6792
__setup ("cgroup_disable=" , cgroup_disable );
6780
6793
6794
+ static int __init cgroup_enable (char * str )
6795
+ {
6796
+ struct cgroup_subsys * ss ;
6797
+ char * token ;
6798
+ int i ;
6799
+
6800
+ while ((token = strsep (& str , "," )) != NULL ) {
6801
+ if (!* token )
6802
+ continue ;
6803
+
6804
+ for_each_subsys (ss , i ) {
6805
+ if (strcmp (token , ss -> name ) &&
6806
+ strcmp (token , ss -> legacy_name ))
6807
+ continue ;
6808
+
6809
+ cgroup_enable_mask |= 1 << i ;
6810
+ static_branch_enable (cgroup_subsys_enabled_key [i ]);
6811
+ pr_info ("Enabling %s control group subsystem\n" ,
6812
+ ss -> name );
6813
+ }
6814
+ }
6815
+ return 1 ;
6816
+ }
6817
+ __setup ("cgroup_enable=" , cgroup_enable );
6818
+
6781
6819
void __init __weak enable_debug_cgroup (void ) { }
6782
6820
6783
6821
static int __init enable_cgroup_debug (char * str )
0 commit comments