kernel: refresh patches
[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 --- 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 @@ -5251,6 +5251,33 @@ 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 + /*
40 + * cgroup_disable, being at boot time, can't know about
41 + * module subsystems, so we don't worry about them.
42 + */
43 + for_each_builtin_subsys(ss, i) {
44 + if (!strcmp(token, ss->name)) {
45 + ss->disabled = 0;
46 + printk(KERN_INFO "Disabling %s control group"
47 + " subsystem\n", ss->name);
48 + break;
49 + }
50 + }
51 + }
52 + return 1;
53 +}
54 +__setup("cgroup_enable=", cgroup_enable);
55 +
56 /**
57 * css_from_dir - get corresponding css from the dentry of a cgroup dir
58 * @dentry: directory dentry of interest
59 --- a/mm/memcontrol.c
60 +++ b/mm/memcontrol.c
61 @@ -7316,6 +7316,7 @@ struct cgroup_subsys mem_cgroup_subsys =
62 .bind = mem_cgroup_bind,
63 .base_cftypes = mem_cgroup_files,
64 .early_init = 0,
65 + .disabled = 1,
66 };
67
68 #ifdef CONFIG_MEMCG_SWAP