kernel: update 3.10 to 3.10.34
[openwrt.git] / target / linux / brcm2708 / patches-3.10 / 0128-config-Enable-CONFIG_MEMCG-but-leave-it-disabled-due.patch
1 From 7793e8e7ab80fb41381652e46dbfe29dae3d7eea 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 128/174] config: Enable CONFIG_MEMCG, but leave it disabled
5  (due to memory cost). Enable with cgroup_enable=memory.
6
7 ---
8  arch/arm/configs/bcmrpi_defconfig |  1 +
9  kernel/cgroup.c                   | 31 +++++++++++++++++++++++++++++++
10  mm/memcontrol.c                   |  1 +
11  3 files changed, 33 insertions(+)
12
13 --- a/arch/arm/configs/bcmrpi_defconfig
14 +++ b/arch/arm/configs/bcmrpi_defconfig
15 @@ -18,6 +18,7 @@ CONFIG_CGROUP_FREEZER=y
16  CONFIG_CGROUP_DEVICE=y
17  CONFIG_CGROUP_CPUACCT=y
18  CONFIG_RESOURCE_COUNTERS=y
19 +CONFIG_MEMCG=y
20  CONFIG_BLK_CGROUP=y
21  CONFIG_NAMESPACES=y
22  CONFIG_SCHED_AUTOGROUP=y
23 --- a/kernel/cgroup.c
24 +++ b/kernel/cgroup.c
25 @@ -5127,6 +5127,37 @@ static int __init cgroup_disable(char *s
26  }
27  __setup("cgroup_disable=", cgroup_disable);
28  
29 +static int __init cgroup_enable(char *str)
30 +{
31 +       int i;
32 +       char *token;
33 +
34 +       while ((token = strsep(&str, ",")) != NULL) {
35 +               if (!*token)
36 +                       continue;
37 +               for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
38 +                       struct cgroup_subsys *ss = subsys[i];
39 +
40 +                       /*
41 +                        * cgroup_enable, being at boot time, can't
42 +                        * know about module subsystems, so we don't
43 +                        * worry about them.
44 +                        */
45 +                       if (!ss || ss->module)
46 +                               continue;
47 +
48 +                       if (!strcmp(token, ss->name)) {
49 +                               ss->disabled = 0;
50 +                               printk(KERN_INFO "Enabling %s control group"
51 +                                       " subsystem\n", ss->name);
52 +                               break;
53 +                       }
54 +               }
55 +       }
56 +       return 1;
57 +}
58 +__setup("cgroup_enable=", cgroup_enable);
59 +
60  /*
61   * Functons for CSS ID.
62   */
63 --- a/mm/memcontrol.c
64 +++ b/mm/memcontrol.c
65 @@ -6970,6 +6970,7 @@ struct cgroup_subsys mem_cgroup_subsys =
66         .base_cftypes = mem_cgroup_files,
67         .early_init = 0,
68         .use_id = 1,
69 +       .disabled = 1,
70  };
71  
72  #ifdef CONFIG_MEMCG_SWAP