1 From 584bc4a6093ceb9aea07673185ee0084edc8690b Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Mon, 27 Nov 2017 17:14:54 +0000
4 Subject: [PATCH 136/454] cgroup: Disable cgroup "memory" by default
6 Some Raspberry Pis have limited RAM and most users won't use the
7 cgroup memory support so it is disabled by default. Enable with:
11 See: https://github.com/raspberrypi/linux/issues/1950
13 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
15 kernel/cgroup/cgroup.c | 30 ++++++++++++++++++++++++++++++
16 1 file changed, 30 insertions(+)
18 --- a/kernel/cgroup/cgroup.c
19 +++ b/kernel/cgroup/cgroup.c
20 @@ -5159,6 +5159,8 @@ int __init cgroup_init_early(void)
23 static u16 cgroup_disable_mask __initdata;
24 +static u16 cgroup_enable_mask __initdata;
25 +static int __init cgroup_disable(char *str);
28 * cgroup_init - cgroup initialization
29 @@ -5197,6 +5199,12 @@ int __init cgroup_init(void)
31 mutex_unlock(&cgroup_mutex);
33 + /* Apply an implicit disable... */
34 + cgroup_disable("memory");
36 + /* ...knowing that an explicit enable will override it. */
37 + cgroup_disable_mask &= ~cgroup_enable_mask;
39 for_each_subsys(ss, ssid) {
41 struct cgroup_subsys_state *css =
42 @@ -5577,6 +5585,28 @@ static int __init cgroup_disable(char *s
44 __setup("cgroup_disable=", cgroup_disable);
46 +static int __init cgroup_enable(char *str)
48 + struct cgroup_subsys *ss;
52 + while ((token = strsep(&str, ",")) != NULL) {
56 + for_each_subsys(ss, i) {
57 + if (strcmp(token, ss->name) &&
58 + strcmp(token, ss->legacy_name))
61 + cgroup_enable_mask |= 1 << i;
66 +__setup("cgroup_enable=", cgroup_enable);
69 * css_tryget_online_from_dir - get corresponding css from a cgroup dentry
70 * @dentry: directory dentry of interest