# disable control groups [resolved]

## josephg

ref this post:

 *a.b. wrote:*   

> You could also check if you've got control groups enabled in your Kernel config, if you have, disable them.

 

how would i do that? i need some confirmation if i'm doing it right.

i had:

```
 $ cat /usr/src/linux/.config | grep -i group

CONFIG_CGROUPS=y

# CONFIG_CGROUP_DEBUG is not set

CONFIG_CGROUP_FREEZER=y

CONFIG_CGROUP_PIDS=y

# CONFIG_CGROUP_DEVICE is not set

CONFIG_CGROUP_CPUACCT=y

# CONFIG_CGROUP_PERF is not set

CONFIG_CGROUP_SCHED=y

CONFIG_FAIR_GROUP_SCHED=y

# CONFIG_RT_GROUP_SCHED is not set

CONFIG_BLK_CGROUP=y

# CONFIG_DEBUG_BLK_CGROUP is not set

CONFIG_SCHED_AUTOGROUP=y

CONFIG_CFQ_GROUP_IOSCHED=y

# CONFIG_CGROUP_NET_PRIO is not set

# CONFIG_CGROUP_NET_CLASSID is not set
```

so i removed what i could, and now i have:

```
$ cat /usr/src/linux/.config | grep -i group                                                                                                                                                     

CONFIG_CGROUPS=y

# CONFIG_CGROUP_DEBUG is not set

# CONFIG_CGROUP_FREEZER is not set

# CONFIG_CGROUP_PIDS is not set

# CONFIG_CGROUP_DEVICE is not set

# CONFIG_CGROUP_CPUACCT is not set

# CONFIG_CGROUP_PERF is not set

CONFIG_CGROUP_SCHED=y

CONFIG_FAIR_GROUP_SCHED=y

# CONFIG_RT_GROUP_SCHED is not set

# CONFIG_BLK_CGROUP is not set

# CONFIG_SCHED_AUTOGROUP is not set

# CONFIG_CGROUP_NET_PRIO is not set

# CONFIG_CGROUP_NET_CLASSID is not set
```

menuconfig won't let me remove CONFIG_CGROUPS=y from gentoo-sources.

----------

## Zucca

```
cd /usr/src/linux

./scripts/config -d CGROUPS
```

... and it's disabled... if no errors occured. Then just recompile your kernel.

I'm not the expert of this cgroups thing, but I have a feeling that it might mess things up when disabled. So backup your kernel and have a meny entry in bootloader configs for the backup kernel.

----------

## josephg

 *Zucca wrote:*   

> 
> 
> ```
> cd /usr/src/linux
> 
> ...

 

fab  :Smile:  thank you

 *Zucca wrote:*   

> I'm not the expert of this cgroups thing, but I have a feeling that it might mess things up when disabled. So backup your kernel and have a meny entry in bootloader configs for the backup kernel.

 

ulp.. perhaps i shouldn't do this then   :Question:   i'm still finding my way around gentoo, and i might not realise if i mess up

i've heard some say that control groups are evil..

----------

## Zucca

You can of course test it first. ;)

----------

## josephg

 *Zucca wrote:*   

> You can of course test it first. 

 

ok to change some config somewhere.. i'm feel reluctant to delete the cgroups codebase from kernel source. how would i revert back? or do you mean backup the whole /usr/src/linux directory itself??

----------

## josephg

ok i found that command. i thought -d was delete!   :Embarassed: 

```
$ /usr/src/linux/scripts/config --help

...

        --enable|-e option   Enable option

        --disable|-d option  Disable option

        --module|-m option   Turn option into a module

        --set-str option string

                             Set option to "string"

        --set-val option value

                             Set option to value

        --undefine|-u option Undefine option

        --state|-s option    Print state of option (n,y,m,undef)

        --enable-after|-E beforeopt option

                             Enable option directly after other option

        --disable-after|-D beforeopt option

                             Disable option directly after other option

        --module-after|-M beforeopt option

                             Turn option into module directly after other option

        commands can be repeated multiple times

options:

        --file config-file   .config file to change (default .config)

        --keep-case|-k       Keep next symbols' case (dont' upper-case it)

config doesn't check the validity of the .config file. This is done at next

make time.

By default, config will upper-case the given symbol. Use --keep-case to keep

the case of all following symbols unchanged.

config uses 'CONFIG_' as the default symbol prefix. Set the environment

variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" config ...
```

thank you Zucca  :Smile:  didn't know about this command.. very handy.. compared to trawling through all those menus looking for something

----------

## josephg

```
# cd /usr/src/linux/

# cat .config | grep CGROUPS

CONFIG_CGROUPS=y

# ./scripts/config -d cgroups

# cat .config | grep CGROUPS

# CONFIG_CGROUPS is not set

# ./scripts/config -e cgroups

# cat .config | grep CGROUPS

CONFIG_CGROUPS=y
```

i like it  :Smile: 

----------

## josephg

 *Zucca wrote:*   

> 
> 
> ```
> cd /usr/src/linux
> 
> ...

 

so that disabled cgroups in .config. but if i do menuconfig, cgroups get enabled again! 

or did you mean disable it like above, and just recompile kernel without going into menuconfig to validate?

----------

## Zucca

 *josephg wrote:*   

> so that disabled cgroups in .config. but if i do menuconfig, cgroups get enabled again!

 Then something is forcibly enabling it by a reason. :) Don't mess with it. ;)

----------

## josephg

 *Zucca wrote:*   

>  *josephg wrote:*   so that disabled cgroups in .config. but if i do menuconfig, cgroups get enabled again! Then something is forcibly enabling it by a reason.  Don't mess with it. 

 

i think gentoo-sources force enable it. i think as you say, i better leave this one alone  :Wink: 

if i do a search within menuconfig, i get this:

```
Symbol: CGROUPS [=y]

  │ Type  : boolean

  │ Prompt: Control Group support

  │   Location:

  │ (1) -> General setup

  │   Defined at init/Kconfig:927

  │   Selects: KERNFS [=y]

  │   Selected by: GENTOO_LINUX_PORTAGE [=y] && GENTOO_LINUX [=y] || GENTOO_LINUX_INIT_SYSTEMD [=n] && GENTOO_LINUX [=y] && GENTOO_LINUX_UDEV [=y] || SCHED_AUTOGROUP [=n]

```

could i have got this or the [Help] text, without going through menuconfig? ie some command line?

----------

## Zucca

 *josephg wrote:*   

> 
> 
> ```
> Symbol: CGROUPS [=y]
> 
> ...

 I think it should be possible some way, but I haven't investigated. Please post if you find a way. :)

----------

## josephg

 *Zucca wrote:*   

>  *josephg wrote:*   could i have got this or the [Help] text, without going through menuconfig? ie some command line? I think it should be possible some way, but I haven't investigated. Please post if you find a way. 

 

ok i found the help text in Kconfig files in all the various subdirectories. i'm still looking through them. we might need your awk skills to extract the text after the help line till the config line.

----------

## josephg

for example, the [Help] text for CGROUPS is found in init/Kconfig after the "help" line

```
$ grep -A12 "config CGROUPS" init/Kconfig

menuconfig CGROUPS

        bool "Control Group support"

        select KERNFS

        help

          This option adds support for grouping sets of processes together, for

          use with process control subsystems such as Cpusets, CFS, memory

          controls or device isolation.

          See

                - Documentation/scheduler/sched-design-CFS.txt  (CFS)

                - Documentation/cgroups/ (features for grouping, isolation

                                          and resource control)

          Say N if unsure.
```

----------

## josephg

```
$ grep -A33 "config ACPI_TOSHIBA" drivers/platform/x86/Kconfig

config ACPI_TOSHIBA

        tristate "Toshiba Laptop Extras"

        depends on ACPI

        depends on ACPI_WMI

        select LEDS_CLASS

        select NEW_LEDS

        depends on BACKLIGHT_CLASS_DEVICE

        depends on INPUT

        depends on SERIO_I8042 || SERIO_I8042 = n

        depends on ACPI_VIDEO || ACPI_VIDEO = n

        select INPUT_POLLDEV

        select INPUT_SPARSEKMAP

        ---help---

          This driver adds support for access to certain system settings

          on "legacy free" Toshiba laptops.  These laptops can be recognized by

          their lack of a BIOS setup menu and APM support.

          On these machines, all system configuration is handled through the

          ACPI.  This driver is required for access to controls not covered

          by the general ACPI drivers, such as LCD brightness, video output,

          etc.

          This driver differs from the non-ACPI Toshiba laptop driver (located

          under "Processor type and features") in several aspects.

          Configuration is accessed by reading and writing text files in the

          /proc tree instead of by program interface to /dev.  Furthermore, no

          power management functions are exposed, as those are handled by the

          general ACPI drivers.

          More information about this driver is available at

          <http://memebeam.org/toys/ToshibaAcpiDriver>.

          If you have a legacy free Toshiba laptop (such as the Libretto L1

          series), say Y.
```

----------

## Zucca

I managed to do it with sed and head...

```
sed -n '/^config ACPI_TOSHIBA/,/^config/p' drivers/platform/x86/Kconfig | head -n -1
```

... for example.

----------

## josephg

 *Zucca wrote:*   

> I managed to do it with sed and head...
> 
> ```
> sed -n '/^config ACPI_TOSHIBA/,/^config/p' drivers/platform/x86/Kconfig | head -n -1
> ```
> ...

 

fab   :Very Happy:  slightly tweaking it.. we might get there yet!

```

sed -n '/config ACPI_TOSHIBA/,/^config/p' drivers/platform/x86/Kconfig | head -n -2

sed -n '/config CGROUPS/,/^config/p' init/Kconfig | head -n -2
```

----------

## josephg

i had a conversation with grknight on #gentoo earlier today. he told me that he had taught ack how to only search through Kconfig files. in short, this is howto:

```
# emerge sys-apps/ack
```

```
--type-add=kernel:match:/Kconfig.*/
```

```
$ ack -l --kernel ACPI_TOSHIBA

drivers/platform/x86/Kconfig
```

and.. we got the filename to do the above  :Smile: 

----------

## Zucca

Well. My awk-fu isn't at its strongest now (need more rtfm), but:

```
find /usr/src/linux/ -type f -iname 'Kconfig*' -print0 | xargs -0 sed -n '/^config ACPI_TOSHIBA/,/^config/p' | head -n -1
```

...does it too.

Actually running cat with xargs and then piping all the output to awk, that then would stop the process after first match, would be ideal. My example here goes trough all the files even if the match was found from the first file.

----------

## josephg

 *Zucca wrote:*   

> Well. My awk-fu isn't at its strongest now (need more rtfm)

 

#kernel guys suggested perl to me.. mine's even worse  :Embarassed: 

 *Zucca wrote:*   

> 
> 
> ```
> find /usr/src/linux/ -type f -iname 'Kconfig*' -print0 | xargs -0 sed -n '/^config ACPI_TOSHIBA/,/^config/p' | head -n -1
> ```
> ...

 

great! all files are named Kconfig only. so we don't need the * after.. bit simpler and quicker.

and you've gotta take your top off  :Wink:  but only the first one, as i tweaked above.. or it won't find the likes of CGROUPS.

so this returns nothing

```
$ find /usr/src/linux/ -type f -iname 'Kconfig*' -print0 | xargs -0 sed -n '/^config CGROUPS/,/^config/p' | head -n -1
```

but this does

```
$ find /usr/src/linux/ -type f -iname 'Kconfig' -print0 | xargs -0 sed -n '/config CGROUPS/,/^config/p' | head -n -1
```

and this works too

```
$ find /usr/src/linux/ -type f -iname 'Kconfig' -print0 | xargs -0 sed -n '/config ACPI_TOSHIBA/,/^config/p' | head -n -1
```

 *Zucca wrote:*   

> Actually running cat with xargs and then piping all the output to awk, that then would stop the process after first match, would be ideal. My example here goes trough all the files even if the match was found from the first file.

 

yes, you're right. some config options should have multiple matches like ACPI_THERMAL or TOSHIBA, as they match partial configs too.

----------

## Zucca

A small improvement would be to replace -iname with -name.

But If you really want this... I'd suggest searching if there was already made tool for this...

----------

