brcm2708: update 3.10 patches with raspberrypi/rpi-3.10.y of 27 Apr. 2014
[openwrt/svn-archive/archive.git] / target / linux / brcm2708 / patches-3.10 / 0128-config-Enable-CONFIG_MEMCG-but-leave-it-disabled-due.patch
1 From 10e9081e9311264f34259527c8d08a8c95beb2da 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/196] 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 diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
14 index 31010e4..fd3229a 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 d0def7f..de9d91a 100644
27 --- a/kernel/cgroup.c
28 +++ b/kernel/cgroup.c
29 @@ -5127,6 +5127,37 @@ 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 + int i;
36 + char *token;
37 +
38 + while ((token = strsep(&str, ",")) != NULL) {
39 + if (!*token)
40 + continue;
41 + for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
42 + struct cgroup_subsys *ss = subsys[i];
43 +
44 + /*
45 + * cgroup_enable, being at boot time, can't
46 + * know about module subsystems, so we don't
47 + * worry about them.
48 + */
49 + if (!ss || ss->module)
50 + continue;
51 +
52 + if (!strcmp(token, ss->name)) {
53 + ss->disabled = 0;
54 + printk(KERN_INFO "Enabling %s control group"
55 + " subsystem\n", ss->name);
56 + break;
57 + }
58 + }
59 + }
60 + return 1;
61 +}
62 +__setup("cgroup_enable=", cgroup_enable);
63 +
64 /*
65 * Functons for CSS ID.
66 */
67 diff --git a/mm/memcontrol.c b/mm/memcontrol.c
68 index f45e21a..28a7e40 100644
69 --- a/mm/memcontrol.c
70 +++ b/mm/memcontrol.c
71 @@ -6970,6 +6970,7 @@ struct cgroup_subsys mem_cgroup_subsys = {
72 .base_cftypes = mem_cgroup_files,
73 .early_init = 0,
74 .use_id = 1,
75 + .disabled = 1,
76 };
77
78 #ifdef CONFIG_MEMCG_SWAP
79 --
80 1.9.1
81