cgroups: Add the hugetlb, net_cls and pids controllers

Note from WilliamH: I slightly rearranged the code and added the
settings in rc.conf.

X-Gentoo-Bug: 555488
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=555488
This commit is contained in:
Austin S. Hemmelgarn 2015-10-06 15:02:28 -05:00 committed by William Hubbs
parent 17ef205bc6
commit 80d3928b0d
2 changed files with 18 additions and 0 deletions

View File

@ -62,12 +62,21 @@ rc_tty_number=12
# Set the devices controller settings for this service. # Set the devices controller settings for this service.
#rc_cgroup_devices="" #rc_cgroup_devices=""
# Set the hugetlb controller settings for this service.
#rc_cgroup_hugetlb=""
# Set the memory controller settings for this service. # Set the memory controller settings for this service.
#rc_cgroup_memory="" #rc_cgroup_memory=""
# Set the net_cls controller settings for this service.
#rc_cgroup_net_cls=""
# Set the net_prio controller settings for this service. # Set the net_prio controller settings for this service.
#rc_cgroup_net_prio="" #rc_cgroup_net_prio=""
# Set the pids controller settings for this service.
#rc_cgroup_pids=""
# Set this to YES if yu want all of the processes in a service's cgroup # Set this to YES if yu want all of the processes in a service's cgroup
# killed when the service is stopped or restarted. # killed when the service is stopped or restarted.
# This should not be set globally because it kills all of the service's # This should not be set globally because it kills all of the service's

View File

@ -109,12 +109,21 @@ cgroup_set_limits()
local devices="${rc_cgroup_devices:-$RC_CGROUP_DEVICES}" local devices="${rc_cgroup_devices:-$RC_CGROUP_DEVICES}"
[ -n "$devices" ] && cgroup_set_values devices "$devices" [ -n "$devices" ] && cgroup_set_values devices "$devices"
local hugetlb="${rc_cgroup_hugetlb:-$RC_CGROUP_HUGETLB}"
[ -n "$hugetlb" ] && cgroup_set_values hugetlb "$hugetlb"
local memory="${rc_cgroup_memory:-$RC_CGROUP_MEMORY}" local memory="${rc_cgroup_memory:-$RC_CGROUP_MEMORY}"
[ -n "$memory" ] && cgroup_set_values memory "$memory" [ -n "$memory" ] && cgroup_set_values memory "$memory"
local net_cls="${rc_cgroup_net_cls:-$RC_CGROUP_NET_CLS}"
[ -n "$net_cls" ] && cgroup_set_values net_cls "$net_cls"
local net_prio="${rc_cgroup_net_prio:-$RC_CGROUP_NET_PRIO}" local net_prio="${rc_cgroup_net_prio:-$RC_CGROUP_NET_PRIO}"
[ -n "$net_prio" ] && cgroup_set_values net_prio "$net_prio" [ -n "$net_prio" ] && cgroup_set_values net_prio "$net_prio"
local pids="${rc_cgroup_pids:-$RC_CGROUP_PIDS}"
[ -n "$pids" ] && cgroup_set_values pids "$pids"
return 0 return 0
} }