48c9b7b590a1908cd634631ac364469a99b7f95b
[oweals/openwrt.git] /
1 From c50fe09c78e9b87137e0188139c774bd4f12dcb2 Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Wed, 18 Dec 2013 22:16:19 +0000
4 Subject: [PATCH] config: Enable CONFIG_MEMCG, but leave it disabled (due to
5  memory cost). Enable with cgroup_enable=memory.
6
7 ---
8  kernel/cgroup.c | 24 +++++++++++++++++++++++-
9  1 file changed, 23 insertions(+), 1 deletion(-)
10
11 --- a/kernel/cgroup.c
12 +++ b/kernel/cgroup.c
13 @@ -5632,7 +5632,7 @@ int __init cgroup_init_early(void)
14         return 0;
15  }
16  
17 -static u16 cgroup_disable_mask __initdata;
18 +static u16 cgroup_disable_mask __initdata = 1<<0;
19  
20  /**
21   * cgroup_init - cgroup initialization
22 @@ -6169,6 +6169,28 @@ static int __init cgroup_no_v1(char *str
23  }
24  __setup("cgroup_no_v1=", cgroup_no_v1);
25  
26 +static int __init cgroup_enable(char *str)
27 +{
28 +       struct cgroup_subsys *ss;
29 +       char *token;
30 +       int i;
31 +
32 +       while ((token = strsep(&str, ",")) != NULL) {
33 +               if (!*token)
34 +                       continue;
35 +
36 +               for_each_subsys(ss, i) {
37 +                       if (strcmp(token, ss->name) &&
38 +                           strcmp(token, ss->legacy_name))
39 +                               continue;
40 +
41 +                       cgroup_disable_mask &= ~(1 << i);
42 +               }
43 +       }
44 +       return 1;
45 +}
46 +__setup("cgroup_enable=", cgroup_enable);
47 +
48  /**
49   * css_tryget_online_from_dir - get corresponding css from a cgroup dentry
50   * @dentry: directory dentry of interest