Skip to content

Commit 65bf5c9

Browse files
Phil Elwellpopcornmix
authored andcommitted
cgroup: Disable cgroup "memory" by default
Some Raspberry Pis have limited RAM and most users won't use the cgroup memory support so it is disabled by default. Enable with: cgroup_enable=memory See: raspberrypi#1950 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
1 parent 889fc01 commit 65bf5c9

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

‎kernel/cgroup/cgroup.c‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5640,6 +5640,8 @@ int __init cgroup_init_early(void)
56405640
}
56415641

56425642
static u16 cgroup_disable_mask __initdata;
5643+
static u16 cgroup_enable_mask __initdata;
5644+
static int __init cgroup_disable(char *str);
56435645

56445646
/**
56455647
* cgroup_init - cgroup initialization
@@ -5679,6 +5681,12 @@ int __init cgroup_init(void)
56795681

56805682
mutex_unlock(&cgroup_mutex);
56815683

5684+
/* Apply an implicit disable... */
5685+
cgroup_disable("memory");
5686+
5687+
/* ...knowing that an explicit enable will override it. */
5688+
cgroup_disable_mask &= ~cgroup_enable_mask;
5689+
56825690
for_each_subsys(ss, ssid) {
56835691
if (ss->early_init) {
56845692
struct cgroup_subsys_state *css =
@@ -6055,6 +6063,28 @@ static int __init cgroup_disable(char *str)
60556063
}
60566064
__setup("cgroup_disable=", cgroup_disable);
60576065

6066+
static int __init cgroup_enable(char *str)
6067+
{
6068+
struct cgroup_subsys *ss;
6069+
char *token;
6070+
int i;
6071+
6072+
while ((token = strsep(&str, ",")) != NULL) {
6073+
if (!*token)
6074+
continue;
6075+
6076+
for_each_subsys(ss, i) {
6077+
if (strcmp(token, ss->name) &&
6078+
strcmp(token, ss->legacy_name))
6079+
continue;
6080+
6081+
cgroup_enable_mask |= 1 << i;
6082+
}
6083+
}
6084+
return 1;
6085+
}
6086+
__setup("cgroup_enable=", cgroup_enable);
6087+
60586088
void __init __weak enable_debug_cgroup(void) { }
60596089

60606090
static int __init enable_cgroup_debug(char *str)

0 commit comments

Comments
 (0)