Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 504834 - sys-apps/openrc-0.12.4: openrc cgroup integration cannot be turned off completely
Summary: sys-apps/openrc-0.12.4: openrc cgroup integration cannot be turned off comple...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-16 21:19 UTC by vinz meier
Modified: 2014-03-18 15:57 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.