cgroups: add rc_cgroup_memory_use_hierarchy setting for cgroups v1

This commit is contained in:
William Hubbs 2018-02-26 14:33:15 -06:00
parent 0506d68427
commit c6047f887a
2 changed files with 8 additions and 0 deletions

View File

@ -227,6 +227,11 @@ rc_tty_number=12
# /sys/fs/cgroup in hybrid or legacy mode. # /sys/fs/cgroup in hybrid or legacy mode.
#rc_controller_cgroups="YES" #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 # The following settings allow you to set up values for the cgroups version 1
# controllers for your services. # controllers for your services.
# They can be set in this file;, however, if you do this, the settings # They can be set in this file;, however, if you do this, the settings

View File

@ -57,6 +57,9 @@ cgroup1_controllers()
mkdir "/sys/fs/cgroup/${name}" mkdir "/sys/fs/cgroup/${name}"
mount -n -t cgroup -o "${cgroup_opts},${name}" \ mount -n -t cgroup -o "${cgroup_opts},${name}" \
"${name}" "/sys/fs/cgroup/${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 esac
done < /proc/cgroups done < /proc/cgroups