kernel: bump 6.1 to 6.1.50
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-6.1 / 950-0084-cgroup-Disable-cgroup-memory-by-default.patch
1 From 9a43e3e7af1f9a4b3961402755dc49251175aaee 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] 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 | 38 ++++++++++++++++++++++++++++++++++++++
16 1 file changed, 38 insertions(+)
17
18 --- a/kernel/cgroup/cgroup.c
19 +++ b/kernel/cgroup/cgroup.c
20 @@ -6061,6 +6061,9 @@ int __init cgroup_init_early(void)
21 return 0;
22 }
23
24 +static u16 cgroup_enable_mask __initdata;
25 +static int __init cgroup_disable(char *str);
26 +
27 /**
28 * cgroup_init - cgroup initialization
29 *
30 @@ -6094,6 +6097,12 @@ int __init cgroup_init(void)
31
32 cgroup_unlock();
33
34 + /*
35 + * Apply an implicit disable, knowing that an explicit enable will
36 + * prevent if from doing anything.
37 + */
38 + cgroup_disable("memory");
39 +
40 for_each_subsys(ss, ssid) {
41 if (ss->early_init) {
42 struct cgroup_subsys_state *css =
43 @@ -6734,6 +6743,10 @@ static int __init cgroup_disable(char *s
44 strcmp(token, ss->legacy_name))
45 continue;
46
47 + /* An explicit cgroup_enable overrides a disable */
48 + if (cgroup_enable_mask & (1 << i))
49 + continue;
50 +
51 static_branch_disable(cgroup_subsys_enabled_key[i]);
52 pr_info("Disabling %s control group subsystem\n",
53 ss->name);
54 @@ -6752,6 +6765,31 @@ static int __init cgroup_disable(char *s
55 }
56 __setup("cgroup_disable=", cgroup_disable);
57
58 +static int __init cgroup_enable(char *str)
59 +{
60 + struct cgroup_subsys *ss;
61 + char *token;
62 + int i;
63 +
64 + while ((token = strsep(&str, ",")) != NULL) {
65 + if (!*token)
66 + continue;
67 +
68 + for_each_subsys(ss, i) {
69 + if (strcmp(token, ss->name) &&
70 + strcmp(token, ss->legacy_name))
71 + continue;
72 +
73 + cgroup_enable_mask |= 1 << i;
74 + static_branch_enable(cgroup_subsys_enabled_key[i]);
75 + pr_info("Enabling %s control group subsystem\n",
76 + ss->name);
77 + }
78 + }
79 + return 1;
80 +}
81 +__setup("cgroup_enable=", cgroup_enable);
82 +
83 void __init __weak enable_debug_cgroup(void) { }
84
85 static int __init enable_cgroup_debug(char *str)