OpenRC/CGroups

Cgroups Overview
OpenRC cgroup implementation follows FDO recommendations.

Turning cgroup support on
Cgroups is available only on Linux. To use cgroups in OpenRC you should turn then in kernel, this switch controls whether or not group for each controller is mounter under.

All other features will work only if you will set

Setting limits
For each cgroup controller one can create special variables of the form: rc_cgroup_${CONTROLLER_NAME}=" ${CONTROLLER_NAME}.${OPTION_NAME} ${OPTION VALUE}

This options can be added in file then they will be applied to all services, however, if you will set it in service.conf file that option will be applied only to that service.

For example, you would use this to set the cpu.shares setting in the cpu controller to 512 for your service. rc_cgroup_cpu=" cpu.shares 512 "

For more information about the adjustments that can be made with cgroups, see in the linux kernel source tree.

Service Cleanup
It's possible to trigger killing all service process tree (in process cgroup) when services is stopped or restarted. By setting

This option should not be set globally as it will kill all service's child processes e.g. SSH connections or apache workers, as OpenRC doesn't support automatic process cgroup-relocation as it done in logind services.

Possible Improvements

 * system notification about cleared cgroups (can be done via sh user script)
 * grouping cgroups subsystems together

Openrc cgroup architecture
TODO: shortly describe architecture