kernel: bump 4.14 to 4.14.93
[openwrt/staging/chunkeey.git] / target / linux / brcm2708 / patches-4.14 / 950-0136-cgroup-Disable-cgroup-memory-by-default.patch
1 From 584bc4a6093ceb9aea07673185ee0084edc8690b Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Mon, 27 Nov 2017 17:14:54 +0000
4 Subject: [PATCH 136/454] cgroup: Disable cgroup "memory" by default
5
6 Some Raspberry Pis have limited RAM and most users won't use the
7 cgroup memory support so it is disabled by default. Enable with:
8
9 cgroup_enable=memory
10
11 See: https://github.com/raspberrypi/linux/issues/1950
12
13 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
14 ---
15 kernel/cgroup/cgroup.c | 30 ++++++++++++++++++++++++++++++
16 1 file changed, 30 insertions(+)
17
18 --- a/kernel/cgroup/cgroup.c
19 +++ b/kernel/cgroup/cgroup.c
20 @@ -5159,6 +5159,8 @@ int __init cgroup_init_early(void)
21 }
22
23 static u16 cgroup_disable_mask __initdata;
24 +static u16 cgroup_enable_mask __initdata;
25 +static int __init cgroup_disable(char *str);
26
27 /**
28 * cgroup_init - cgroup initialization
29 @@ -5197,6 +5199,12 @@ int __init cgroup_init(void)
30
31 mutex_unlock(&cgroup_mutex);
32
33 + /* Apply an implicit disable... */
34 + cgroup_disable("memory");
35 +
36 + /* ...knowing that an explicit enable will override it. */
37 + cgroup_disable_mask &= ~cgroup_enable_mask;
38 +
39 for_each_subsys(ss, ssid) {
40 if (ss->early_init) {
41 struct cgroup_subsys_state *css =
42 @@ -5577,6 +5585,28 @@ static int __init cgroup_disable(char *s
43 }
44 __setup("cgroup_disable=", cgroup_disable);
45
46 +static int __init cgroup_enable(char *str)
47 +{
48 + struct cgroup_subsys *ss;
49 + char *token;
50 + int i;
51 +
52 + while ((token = strsep(&str, ",")) != NULL) {
53 + if (!*token)
54 + continue;
55 +
56 + for_each_subsys(ss, i) {
57 + if (strcmp(token, ss->name) &&
58 + strcmp(token, ss->legacy_name))
59 + continue;
60 +
61 + cgroup_enable_mask |= 1 << i;
62 + }
63 + }
64 + return 1;
65 +}
66 +__setup("cgroup_enable=", cgroup_enable);
67 +
68 /**
69 * css_tryget_online_from_dir - get corresponding css from a cgroup dentry
70 * @dentry: directory dentry of interest