Merge pull request #580 from wigyori/cc-libpcap
[15.05/openwrt.git] / target / linux / brcm2708 / patches-3.18 / 0024-config-Enable-CONFIG_MEMCG-but-leave-it-disabled-due.patch
1 From 32839a570568823b3a1128bb1ae6c5fe3e9870af 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 024/114] 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                   | 23 +++++++++++++++++++++++
10  mm/memcontrol.c                   |  1 +
11  3 files changed, 25 insertions(+)
12
13 --- a/arch/arm/configs/bcmrpi_defconfig
14 +++ b/arch/arm/configs/bcmrpi_defconfig
15 @@ -19,6 +19,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 @@ -5319,6 +5319,29 @@ 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 +       struct cgroup_subsys *ss;
32 +       char *token;
33 +       int i;
34 +
35 +       while ((token = strsep(&str, ",")) != NULL) {
36 +               if (!*token)
37 +                       continue;
38 +
39 +               for_each_subsys(ss, i) {
40 +                       if (!strcmp(token, ss->name)) {
41 +                               ss->disabled = 0;
42 +                               printk(KERN_INFO "Enabling %s control group"
43 +                                       " subsystem\n", ss->name);
44 +                               break;
45 +                       }
46 +               }
47 +       }
48 +       return 1;
49 +}
50 +__setup("cgroup_enable=", cgroup_enable);
51 +
52  static int __init cgroup_set_legacy_files_on_dfl(char *str)
53  {
54         printk("cgroup: using legacy files on the default hierarchy\n");
55 --- a/mm/memcontrol.c
56 +++ b/mm/memcontrol.c
57 @@ -6208,6 +6208,7 @@ struct cgroup_subsys memory_cgrp_subsys
58         .bind = mem_cgroup_bind,
59         .legacy_cftypes = mem_cgroup_files,
60         .early_init = 0,
61 +       .disabled = 1,
62  };
63  
64  #ifdef CONFIG_MEMCG_SWAP