1 |
commit: c6047f887a362cb8d96624fbd73484ca703acf53 |
2 |
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon Feb 26 20:33:15 2018 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Feb 26 20:33:15 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=c6047f88 |
7 |
|
8 |
cgroups: add rc_cgroup_memory_use_hierarchy setting for cgroups v1 |
9 |
|
10 |
etc/rc.conf | 5 +++++ |
11 |
init.d/cgroups.in | 3 +++ |
12 |
2 files changed, 8 insertions(+) |
13 |
|
14 |
diff --git a/etc/rc.conf b/etc/rc.conf |
15 |
index b7296d35..32c905d4 100644 |
16 |
--- a/etc/rc.conf |
17 |
+++ b/etc/rc.conf |
18 |
@@ -227,6 +227,11 @@ rc_tty_number=12 |
19 |
# /sys/fs/cgroup in hybrid or legacy mode. |
20 |
#rc_controller_cgroups="YES" |
21 |
|
22 |
+# The following setting turns on the memory.use_hierarchy setting in the |
23 |
+# root memory cgroup for cgroups v1. |
24 |
+# It must be set to yes in this file if you want this functionality. |
25 |
+#rc_cggroup_memory_use_hierarchy="NO" |
26 |
+ |
27 |
# The following settings allow you to set up values for the cgroups version 1 |
28 |
# controllers for your services. |
29 |
# They can be set in this file;, however, if you do this, the settings |
30 |
|
31 |
diff --git a/init.d/cgroups.in b/init.d/cgroups.in |
32 |
index 8ec91ef6..01f5dd48 100644 |
33 |
--- a/init.d/cgroups.in |
34 |
+++ b/init.d/cgroups.in |
35 |
@@ -57,6 +57,9 @@ cgroup1_controllers() |
36 |
mkdir "/sys/fs/cgroup/${name}" |
37 |
mount -n -t cgroup -o "${cgroup_opts},${name}" \ |
38 |
"${name}" "/sys/fs/cgroup/${name}" |
39 |
+ yesno "${rc_cgroup_memory_use_hierarchy:-no}" && |
40 |
+ [ "${name}" = memory ] && |
41 |
+ echo 1 > /sys/fs/cgroup/memory/memory.use_hierarchy |
42 |
;; |
43 |
esac |
44 |
done < /proc/cgroups |