dec8cdf0cdb721a761fd01d317bdc1d228c080c1
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-3.14 / 0027-config-Enable-CONFIG_MEMCG-but-leave-it-disabled-due.patch
1 From 6f2dc468edc31cf2c9b2098566cbbcc1e59b5ad5 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 27/54] config: Enable CONFIG_MEMCG, but leave it disabled (due
5 to memory cost). Enable with cgroup_enable=memory.
6
7 ---
8 arch/arm/configs/bcmrpi_defconfig | 1 +
9 kernel/cgroup.c | 27 +++++++++++++++++++++++++++
10 mm/memcontrol.c | 1 +
11 3 files changed, 29 insertions(+)
12
13 diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
14 index 78d789c..e89e430 100644
15 --- a/arch/arm/configs/bcmrpi_defconfig
16 +++ b/arch/arm/configs/bcmrpi_defconfig
17 @@ -18,6 +18,7 @@ CONFIG_CGROUP_FREEZER=y
18 CONFIG_CGROUP_DEVICE=y
19 CONFIG_CGROUP_CPUACCT=y
20 CONFIG_RESOURCE_COUNTERS=y
21 +CONFIG_MEMCG=y
22 CONFIG_BLK_CGROUP=y
23 CONFIG_NAMESPACES=y
24 CONFIG_SCHED_AUTOGROUP=y
25 diff --git a/kernel/cgroup.c b/kernel/cgroup.c
26 index 0c753dd..a18b46e 100644
27 --- a/kernel/cgroup.c
28 +++ b/kernel/cgroup.c
29 @@ -5252,6 +5252,33 @@ static int __init cgroup_disable(char *str)
30 }
31 __setup("cgroup_disable=", cgroup_disable);
32
33 +static int __init cgroup_enable(char *str)
34 +{
35 + struct cgroup_subsys *ss;
36 + char *token;
37 + int i;
38 +
39 + while ((token = strsep(&str, ",")) != NULL) {
40 + if (!*token)
41 + continue;
42 +
43 + /*
44 + * cgroup_disable, being at boot time, can't know about
45 + * module subsystems, so we don't worry about them.
46 + */
47 + for_each_builtin_subsys(ss, i) {
48 + if (!strcmp(token, ss->name)) {
49 + ss->disabled = 0;
50 + printk(KERN_INFO "Disabling %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 * css_from_dir - get corresponding css from the dentry of a cgroup dir
62 * @dentry: directory dentry of interest
63 diff --git a/mm/memcontrol.c b/mm/memcontrol.c
64 index 9b35da2..a9891cc 100644
65 --- a/mm/memcontrol.c
66 +++ b/mm/memcontrol.c
67 @@ -7289,6 +7289,7 @@ struct cgroup_subsys mem_cgroup_subsys = {
68 .bind = mem_cgroup_bind,
69 .base_cftypes = mem_cgroup_files,
70 .early_init = 0,
71 + .disabled = 1,
72 };
73
74 #ifdef CONFIG_MEMCG_SWAP
75 --
76 1.9.1
77