Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 504834

Summary: sys-apps/openrc-0.12.4: openrc cgroup integration cannot be turned off completely
Product: Gentoo Hosted Projects Reporter: vinz meier <vinz>
Component: OpenRCAssignee: OpenRC Team <openrc>
Status: RESOLVED INVALID    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description vinz meier 2014-03-16 21:19:41 UTC
<quote /etc/rc.conf>
# If you have cgroups turned on in your kernel, this switch controls
# whether or not a group for each controller is mounted under
# /sys/fs/cgroup.
# None of the other options in this section work if this is set to "NO".
rc_controller_cgroups="NO"
</quote>

# find /sys/fs/cgroup/openrc/|wc -l
224

Although the rc.conf states only setting the variable "rc_controller_cgroups" to "YES" will affect openrc's use of cgroups, the code in /etc/init.d/sysfs does otherwise

Reproducible: Always

Steps to Reproduce:
1. set rc_controller_cgroups="NO" in /etc/rc.conf
2. reboot

Actual Results:  
# find /sys/fs/cgroup/openrc/|wc -l
224

Expected Results:  
# find /sys/fs/cgroup/openrc
find: `/sys/fs/cgroup/openrc': No such file or directory


<quote /etc/init.d/sysfs

mount_cgroups()
{
                mountinfo -q /sys/fs/cgroup || return 0

        local agent="/lib64/rc/sh/cgroup-release-agent.sh"
        mkdir /sys/fs/cgroup/openrc
        mount -n -t cgroup \
                -o none,${sysfs_opts},name=openrc,release_agent="$agent" \
                openrc /sys/fs/cgroup/openrc
        echo 1 > /sys/fs/cgroup/openrc/notify_on_release

        yesno ${rc_controller_cgroups:-YES} && [ -e /proc/cgroups ] || return 0
[...]
</quote>


is there a (compatibility?) reason why the line which checks for the setting of the rc_controller_cgroups variable is not the first line of the function?
Comment 1 William Hubbs gentoo-dev 2014-03-18 15:57:02 UTC
(In reply to vinz meier from comment #0)
> <quote /etc/rc.conf>
> # If you have cgroups turned on in your kernel, this switch controls
> # whether or not a group for each controller is mounted under
> # /sys/fs/cgroup.
> # None of the other options in this section work if this is set to "NO".
> rc_controller_cgroups="NO"
> </quote>
> 
> # find /sys/fs/cgroup/openrc/|wc -l
> 224
> 
> Although the rc.conf states only setting the variable
> "rc_controller_cgroups" to "YES" will affect openrc's use of cgroups, the
> code in /etc/init.d/sysfs does otherwise

rc_controller_cgroups affects OpenRC's use of cgroups exactly as it describes it does. The /sys/fs/cgroup/openrc cgroup has no controllers attached to it.

> Reproducible: Always
> 
> Steps to Reproduce:
> 1. set rc_controller_cgroups="NO" in /etc/rc.conf
> 2. reboot
> 
> Actual Results:  
> # find /sys/fs/cgroup/openrc/|wc -l
> 224

What about looking in /sys/fs/cgroup for any directories other than openrc? rc_controller_cgroups controls directories like "cpu" "memory" etc that are in /sys/fs/cgroup. Everything under /sys/fs/cgroup/openrc will be created regardless.

> Expected Results:  
> # find /sys/fs/cgroup/openrc
> find: `/sys/fs/cgroup/openrc': No such file or directory

This would imply that /sys/fs/cgroup/openrc does not exist, and that is not how the cgroup integration works, unless you do not have cgroups enabled in any form in the kernel.


> 
> 
> <quote /etc/init.d/sysfs
> 
> mount_cgroups()
> {
>                 mountinfo -q /sys/fs/cgroup || return 0
> 
>         local agent="/lib64/rc/sh/cgroup-release-agent.sh"
>         mkdir /sys/fs/cgroup/openrc
>         mount -n -t cgroup \
>                 -o none,${sysfs_opts},name=openrc,release_agent="$agent" \
>                 openrc /sys/fs/cgroup/openrc
>         echo 1 > /sys/fs/cgroup/openrc/notify_on_release
>         yesno ${rc_controller_cgroups:-YES} && [ -e /proc/cgroups ] ||
> return 0
> [...]
> </quote>
> 
> 
> is there a (compatibility?) reason why the line which checks for the setting
> of the rc_controller_cgroups variable is not the first line of the function?

This is by design, we always have the openrc cgroup for tracking which services and child processes are started by OpenRC. It doesn't have any controllers attached (see the "-o none" in the mount command, so it shouldn't break anything.