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 grup for each controller is mounter under /sys/fs/cgroup.

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 rc.conf 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 Documentation/cgroups/* in the linux kernel source tree.

Setting limits
TODO:

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