Skip to content

Commit 45e1ba4

Browse files
shakeelbhtejun
authored andcommitted
cgroup: disable controllers at parse time
This patch effectively reverts the commit a3e7273 ("cgroup: fix too early usage of static_branch_disable()"). The commit 6041186 ("init: initialize jump labels before command line option parsing") has moved the jump_label_init() before parse_args() which has made the commit a3e7273 unnecessary. On the other hand there are consequences of disabling the controllers later as there are subsystems doing the controller checks for different decisions. One such incident is reported [1] regarding the memory controller and its impact on memory reclaim code. [1] https://lore.kernel.org/linux-mm/[email protected] Signed-off-by: Shakeel Butt <[email protected]> Reported-by: NOMURA JUNICHI(野村 淳一) <[email protected]> Signed-off-by: Tejun Heo <[email protected]> Tested-by: Jun'ichi Nomura <[email protected]>
1 parent c3d0e3f commit 45e1ba4

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

kernel/cgroup/cgroup.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5634,8 +5634,6 @@ int __init cgroup_init_early(void)
56345634
return 0;
56355635
}
56365636

5637-
static u16 cgroup_disable_mask __initdata;
5638-
56395637
/**
56405638
* cgroup_init - cgroup initialization
56415639
*
@@ -5694,12 +5692,8 @@ int __init cgroup_init(void)
56945692
* disabled flag and cftype registration needs kmalloc,
56955693
* both of which aren't available during early_init.
56965694
*/
5697-
if (cgroup_disable_mask & (1 << ssid)) {
5698-
static_branch_disable(cgroup_subsys_enabled_key[ssid]);
5699-
printk(KERN_INFO "Disabling %s control group subsystem\n",
5700-
ss->name);
5695+
if (!cgroup_ssid_enabled(ssid))
57015696
continue;
5702-
}
57035697

57045698
if (cgroup1_ssid_disabled(ssid))
57055699
printk(KERN_INFO "Disabling %s control group subsystem in v1 mounts\n",
@@ -6214,7 +6208,10 @@ static int __init cgroup_disable(char *str)
62146208
if (strcmp(token, ss->name) &&
62156209
strcmp(token, ss->legacy_name))
62166210
continue;
6217-
cgroup_disable_mask |= 1 << i;
6211+
6212+
static_branch_disable(cgroup_subsys_enabled_key[i]);
6213+
pr_info("Disabling %s control group subsystem\n",
6214+
ss->name);
62186215
}
62196216
}
62206217
return 1;

0 commit comments

Comments
 (0)