@@ -6051,6 +6051,9 @@ int __init cgroup_init_early(void)
60516051 return 0 ;
60526052}
60536053
6054+ static u16 cgroup_enable_mask __initdata ;
6055+ static int __init cgroup_disable (char * str );
6056+
60546057/**
60556058 * cgroup_init - cgroup initialization
60566059 *
@@ -6084,6 +6087,12 @@ int __init cgroup_init(void)
60846087
60856088 cgroup_unlock ();
60866089
6090+ /*
6091+ * Apply an implicit disable, knowing that an explicit enable will
6092+ * prevent if from doing anything.
6093+ */
6094+ cgroup_disable ("memory" );
6095+
60876096 for_each_subsys (ss , ssid ) {
60886097 if (ss -> early_init ) {
60896098 struct cgroup_subsys_state * css =
@@ -6724,6 +6733,10 @@ static int __init cgroup_disable(char *str)
67246733 strcmp (token , ss -> legacy_name ))
67256734 continue ;
67266735
6736+ /* An explicit cgroup_enable overrides a disable */
6737+ if (cgroup_enable_mask & (1 << i ))
6738+ continue ;
6739+
67276740 static_branch_disable (cgroup_subsys_enabled_key [i ]);
67286741 pr_info ("Disabling %s control group subsystem\n" ,
67296742 ss -> name );
@@ -6742,6 +6755,31 @@ static int __init cgroup_disable(char *str)
67426755}
67436756__setup ("cgroup_disable=" , cgroup_disable );
67446757
6758+ static int __init cgroup_enable (char * str )
6759+ {
6760+ struct cgroup_subsys * ss ;
6761+ char * token ;
6762+ int i ;
6763+
6764+ while ((token = strsep (& str , "," )) != NULL ) {
6765+ if (!* token )
6766+ continue ;
6767+
6768+ for_each_subsys (ss , i ) {
6769+ if (strcmp (token , ss -> name ) &&
6770+ strcmp (token , ss -> legacy_name ))
6771+ continue ;
6772+
6773+ cgroup_enable_mask |= 1 << i ;
6774+ static_branch_enable (cgroup_subsys_enabled_key [i ]);
6775+ pr_info ("Enabling %s control group subsystem\n" ,
6776+ ss -> name );
6777+ }
6778+ }
6779+ return 1 ;
6780+ }
6781+ __setup ("cgroup_enable=" , cgroup_enable );
6782+
67456783void __init __weak enable_debug_cgroup (void ) { }
67466784
67476785static int __init enable_cgroup_debug (char * str )
0 commit comments