summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Elwell <phil@raspberrypi.org>2017-09-18 12:01:46 +0100
committerpopcornmix <popcornmix@gmail.com>2017-09-19 12:01:03 +0100
commitba742b52e5099b3ed964e78f227dc96460b5cdc0 (patch)
tree1f1dddfc87cac9ccbb202bb56dd5576d67a6436d
parent95b592469ab55bf730ac0c6433077f53a11b5551 (diff)
cgroup: Add kernel param to enable memory grouplinaro-20170919-001linaro-17.09-rpi3
cgroup support is useful, but enabling the "memory" cgroup has a 32-byte overhead per page. Arrange that "memory" cgroup is disabled by default unless the "cgroup_memory" parameter is set to a true value. See: https://github.com/raspberrypi/issues/1950 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
-rw-r--r--kernel/cgroup.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 2c785f957024..c3f5abf0fd7a 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -5638,6 +5638,8 @@ int __init cgroup_init_early(void)
}
static u16 cgroup_disable_mask __initdata;
+static bool cgroup_enable_memory;
+static int __init cgroup_disable(char *str);
/**
* cgroup_init - cgroup initialization
@@ -5676,6 +5678,9 @@ int __init cgroup_init(void)
mutex_unlock(&cgroup_mutex);
+ if (!cgroup_enable_memory)
+ cgroup_disable("memory");
+
for_each_subsys(ss, ssid) {
if (ss->early_init) {
struct cgroup_subsys_state *css =
@@ -6151,6 +6156,13 @@ static int __init cgroup_disable(char *str)
}
__setup("cgroup_disable=", cgroup_disable);
+static int __init cgroup_memory(char *str)
+{
+ kstrtobool(str, &cgroup_enable_memory);
+ return 1;
+}
+__setup("cgroup_memory=", cgroup_memory);
+
static int __init cgroup_no_v1(char *str)
{
struct cgroup_subsys *ss;