Skip to content

Commit 0ce4380

Browse files
committed
config: Enable CONFIG_MEMCG, but leave it disabled (due to memory cost). Enable with cgroup_enable=memory.
1 parent a77c03e commit 0ce4380

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

‎arch/arm/configs/bcmrpi_defconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ CONFIG_CGROUP_FREEZER=y
1818
CONFIG_CGROUP_DEVICE=y
1919
CONFIG_CGROUP_CPUACCT=y
2020
CONFIG_RESOURCE_COUNTERS=y
21+
CONFIG_MEMCG=y
2122
CONFIG_BLK_CGROUP=y
2223
CONFIG_NAMESPACES=y
2324
CONFIG_SCHED_AUTOGROUP=y

‎kernel/cgroup.c‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5214,6 +5214,29 @@ static int __init cgroup_disable(char *str)
52145214
}
52155215
__setup("cgroup_disable=", cgroup_disable);
52165216

5217+
static int __init cgroup_enable(char *str)
5218+
{
5219+
struct cgroup_subsys *ss;
5220+
char *token;
5221+
int i;
5222+
5223+
while ((token = strsep(&str, ",")) != NULL) {
5224+
if (!*token)
5225+
continue;
5226+
5227+
for_each_subsys(ss, i) {
5228+
if (!strcmp(token, ss->name)) {
5229+
ss->disabled = 0;
5230+
printk(KERN_INFO "Enabling %s control group"
5231+
" subsystem\n", ss->name);
5232+
break;
5233+
}
5234+
}
5235+
}
5236+
return 1;
5237+
}
5238+
__setup("cgroup_enable=", cgroup_enable);
5239+
52175240
/**
52185241
* css_tryget_online_from_dir - get corresponding css from a cgroup dentry
52195242
* @dentry: directory dentry of interest

‎mm/memcontrol.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7055,6 +7055,7 @@ struct cgroup_subsys memory_cgrp_subsys = {
70557055
.bind = mem_cgroup_bind,
70567056
.base_cftypes = mem_cgroup_files,
70577057
.early_init = 0,
7058+
.disabled = 1,
70587059
};
70597060

70607061
#ifdef CONFIG_MEMCG_SWAP

0 commit comments

Comments
 (0)