From c6047f887a362cb8d96624fbd73484ca703acf53 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Mon, 26 Feb 2018 14:33:15 -0600 Subject: [PATCH] cgroups: add rc_cgroup_memory_use_hierarchy setting for cgroups v1 --- etc/rc.conf | 5 +++++ init.d/cgroups.in | 3 +++ 2 files changed, 8 insertions(+) diff --git a/etc/rc.conf b/etc/rc.conf index b7296d35..32c905d4 100644 --- a/etc/rc.conf +++ b/etc/rc.conf @@ -227,6 +227,11 @@ rc_tty_number=12 # /sys/fs/cgroup in hybrid or legacy mode. #rc_controller_cgroups="YES" +# The following setting turns on the memory.use_hierarchy setting in the +# root memory cgroup for cgroups v1. +# It must be set to yes in this file if you want this functionality. +#rc_cggroup_memory_use_hierarchy="NO" + # The following settings allow you to set up values for the cgroups version 1 # controllers for your services. # They can be set in this file;, however, if you do this, the settings diff --git a/init.d/cgroups.in b/init.d/cgroups.in index 8ec91ef6..01f5dd48 100644 --- a/init.d/cgroups.in +++ b/init.d/cgroups.in @@ -57,6 +57,9 @@ cgroup1_controllers() mkdir "/sys/fs/cgroup/${name}" mount -n -t cgroup -o "${cgroup_opts},${name}" \ "${name}" "/sys/fs/cgroup/${name}" + yesno "${rc_cgroup_memory_use_hierarchy:-no}" && + [ "${name}" = memory ] && + echo 1 > /sys/fs/cgroup/memory/memory.use_hierarchy ;; esac done < /proc/cgroups