Skip to contentSkip to conversation

Documentation: cgroup: clarify controller enabling semantics

PATCH In review Vishal Chourasia 4 participants 11 messages May 27, 2025 – May 28, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Documentation: cgroup: clarify controller enabling semantics

The documentation for cgroup controller management has been updated to be more consistent regarding following concepts:

What does it mean to have controllers
1) available in a cgroup, vs.
2) enabled in a cgroup

Which has been clearly defined below in the documentation.

"Enabling a controller in a cgroup indicates that the distribution of the target resource across its immediate children will be controlled. Consider the following sub-hierarchy"

As an example, consider

/sys/fs/cgroup # cat cgroup.controllers
cpuset cpu io memory hugetlb pids misc
/sys/fs/cgroup # cat cgroup.subtree_control # No controllers by default /sys/fs/cgroup # echo +cpu +memory > cgroup.subtree_control /sys/fs/cgroup # cat cgroup.subtree_control
cpu memory # cpu and memory enabled in /sys/fs/cgroup
/sys/fs/cgroup # mkdir foo_cgrp
/sys/fs/cgroup # cd foo_cgrp/
/sys/fs/cgroup/foo_cgrp # cat cgroup.controllers
cpu memory # cpu and memory available in 'foo_cgrp'
/sys/fs/cgroup/foo_cgrp # cat cgroup.subtree_control # empty by default /sys/fs/cgroup/foo_cgrp # ls

cgroup.controllers      cpu.max.burst           memory.numa_stat
cgroup.events           cpu.pressure            memory.oom.group
cgroup.freeze           cpu.stat                memory.peak
cgroup.kill             cpu.stat.local          memory.pressure
cgroup.max.depth        cpu.weight              memory.reclaim
cgroup.max.descendants  cpu.weight.nice         memory.stat
cgroup.pressure         io.pressure             memory.swap.current
cgroup.procs            memory.current          memory.swap.events
cgroup.stat             memory.events           memory.swap.high
cgroup.subtree_control  memory.events.local     memory.swap.max
cgroup.threads          memory.high             memory.swap.peak
cgroup.type             memory.low              memory.zswap.current
cpu.idle                memory.max              memory.zswap.max
cpu.max                 memory.min              memory.zswap.writeback

Once a controller is available in a cgroup it can be used to resource control processes of the cgroup.

---
 Documentation/admin-guide/cgroup-v2.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/admin-guide/cgroup-v2.rst +2 -2
index 1a16ce68a4d7..0e1686511c45 100644
@@ -438,8 +438,8 @@ Controlling Controllers
 Enabling and Disabling
 ~~~~~~~~~~~~~~~~~~~~~~
 
-Each cgroup has a "cgroup.controllers" file which lists all
-controllers available for the cgroup to enable::
+Each cgroup has a cgroup.controllers file, which lists all the controllers
+available for that cgroup and which can be enabled for its children.
 
   # cat cgroup.controllers
   cpu io memory
Signature · 1 line
2.49.0
maintainer
#1 lore raw

Hello.

Documentation/admin-guide/cgroup-v2.rst Controlling Controllers · line 445

Quoted 13 lines · Vishal Chourasia
Documentation/admin-guide/cgroup-v2.rst +2 -2
@@ -438,8 +438,8 @@ Controlling Controllers
 Enabling and Disabling
 ~~~~~~~~~~~~~~~~~~~~~~
 
-Each cgroup has a "cgroup.controllers" file which lists all
-controllers available for the cgroup to enable::
+Each cgroup has a cgroup.controllers file, which lists all the controllers
+available for that cgroup and which can be enabled for its children.
 
   # cat cgroup.controllers
   cpu io memory

Honestly, I see little difference between the two resulting formulations. Could you perhaps add an example where the documentation confused you or behavior was not what you expected based on the docs?

Thanks,
Michal

#2 lore raw
Quoted 14 lines · Michal Koutný

Hello.

Quoted 11 lines · Vishal Chourasia
Documentation/admin-guide/cgroup-v2.rst +2 -2
@@ -438,8 +438,8 @@ Controlling Controllers
 Enabling and Disabling
 ~~~~~~~~~~~~~~~~~~~~~~
 
-Each cgroup has a "cgroup.controllers" file which lists all
-controllers available for the cgroup to enable::
+Each cgroup has a cgroup.controllers file, which lists all the controllers
+available for that cgroup and which can be enabled for its children.
 
Quoted 6 lines

Documentation/admin-guide/cgroup-v2.rst Controlling Controllers · line 445

Quoted 2 lines
Documentation/admin-guide/cgroup-v2.rst +0 -0
   # cat cgroup.controllers
   cpu io memory

Honestly, I see little difference between the two resulting formulations. Could you perhaps add an example where the documentation confused you or behavior was not what you expected based on the docs?

Hello Michal,

The part that was confused me, was the meaning behind controller being available vs. enabled in a cgroup.

Though, the documentation does mention what it means for a controller to be enabled in a cgroup later in the text. But at the point of the change it is unclear.

Thanks
Vishal

Quoted 3 lines

Thanks,
Michal

maintainer
#3 lore raw
Quoted 6 lines · Vishal Chourasia

The part that was confused me, was the meaning behind controller being available vs. enabled in a cgroup.

Though, the documentation does mention what it means for a controller to be enabled in a cgroup later in the text. But at the point of the change it is unclear.

There's a picture [1] that may be more descriptive than the docs (on which it is based).

HTH,
Michal

[1] https://paste.opensuse.org/pastes/987b665209bb

#4 lore raw
Quoted 10 lines · Michal Koutný
Quoted 6 lines · Vishal Chourasia

The part that was confused me, was the meaning behind controller being available vs. enabled in a cgroup.

Though, the documentation does mention what it means for a controller to be enabled in a cgroup later in the text. But at the point of the change it is unclear.

There's a picture [1] that may be more descriptive than the docs (on which it is based).

Thanks for the reference.

I didn't get the part about "io controller enabling memory controller too". Is it referring to the fact that multiple controller can work together in a cgroup? Because, enabling just the io controller does not automatically enable memory controller too.

Okay, what do you suggest, should I send out V2 taking corrections from others?

Regards,
Vishal

Quoted 5 lines

HTH,
Michal

[1] https://paste.opensuse.org/pastes/987b665209bb

#5 lore raw
In reply to Michal Koutný
Quoted 14 lines · Michal Koutný

Hello.

Quoted 11 lines · Vishal Chourasia
Documentation/admin-guide/cgroup-v2.rst +2 -2
@@ -438,8 +438,8 @@ Controlling Controllers
 Enabling and Disabling
 ~~~~~~~~~~~~~~~~~~~~~~
 
-Each cgroup has a "cgroup.controllers" file which lists all
-controllers available for the cgroup to enable::
+Each cgroup has a cgroup.controllers file, which lists all the controllers
+available for that cgroup and which can be enabled for its children.
 
Quoted 6 lines

Documentation/admin-guide/cgroup-v2.rst Controlling Controllers · line 445

Quoted 2 lines
Documentation/admin-guide/cgroup-v2.rst +0 -0
   # cat cgroup.controllers
   cpu io memory

Honestly, I see little difference between the two resulting formulations. Could you perhaps add an example where the documentation confused you or behavior was not what you expected based on the docs?

You are right, there is little difference. I wanted to highlight the point, that, Availablity means controller can be used to resource control a cgroup, while Enablement means controller is now "availble" to children of the cgroup.

Regards,
Vishal

Quoted 3 lines

Thanks,
Michal

#6 lore raw
In reply to Vishal Chourasia

Documentation/admin-guide/cgroup-v2.rst Controlling Controllers · line 442

Quoted 12 lines · Vishal Chourasia
Documentation/admin-guide/cgroup-v2.rst +2 -2
index 1a16ce68a4d7..0e1686511c45 100644
@@ -438,8 +438,8 @@ Controlling Controllers
 Enabling and Disabling
 ~~~~~~~~~~~~~~~~~~~~~~
 
-Each cgroup has a "cgroup.controllers" file which lists all
-controllers available for the cgroup to enable::
+Each cgroup has a cgroup.controllers file, which lists all the controllers
+available for that cgroup and which can be enabled for its children.

Keep the double colon (literal code block).

Quoted 6 lines
Documentation/admin-guide/cgroup-v2.rst +0 -0
   # cat cgroup.controllers
   cpu io memory
Signature · 1 line
2.49.0

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#7 lore raw
Quoted 9 lines · Bagas Sanjaya
Quoted 8 lines · Vishal Chourasia
Documentation/admin-guide/cgroup-v2.rst +0 -0
index 1a16ce68a4d7..0e1686511c45 100644
@@ -438,8 +438,8 @@ Controlling Controllers
 Enabling and Disabling
 ~~~~~~~~~~~~~~~~~~~~~~
 
Quoted 6 lines

Documentation/admin-guide/cgroup-v2.rst Controlling Controllers · line 442

Quoted 4 lines
Documentation/admin-guide/cgroup-v2.rst +2 -2
-Each cgroup has a "cgroup.controllers" file which lists all
-controllers available for the cgroup to enable::
+Each cgroup has a cgroup.controllers file, which lists all the controllers
+available for that cgroup and which can be enabled for its children.

Keep the double colon (literal code block).

Sure, thanks!

Vishal

Quoted 12 lines
Quoted 7 lines
Documentation/admin-guide/cgroup-v2.rst +0 -0
   # cat cgroup.controllers
   cpu io memory
Signature · 1 line
2.49.0

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#8 lore raw
In reply to Vishal Chourasia
Quoted 55 lines · Vishal Chourasia

The documentation for cgroup controller management has been updated to be more consistent regarding following concepts:

What does it mean to have controllers
1) available in a cgroup, vs.
2) enabled in a cgroup

Which has been clearly defined below in the documentation.

"Enabling a controller in a cgroup indicates that the distribution of the target resource across its immediate children will be controlled. Consider the following sub-hierarchy"

As an example, consider

/sys/fs/cgroup # cat cgroup.controllers
cpuset cpu io memory hugetlb pids misc
/sys/fs/cgroup # cat cgroup.subtree_control # No controllers by default /sys/fs/cgroup # echo +cpu +memory > cgroup.subtree_control /sys/fs/cgroup # cat cgroup.subtree_control
cpu memory # cpu and memory enabled in /sys/fs/cgroup
/sys/fs/cgroup # mkdir foo_cgrp
/sys/fs/cgroup # cd foo_cgrp/
/sys/fs/cgroup/foo_cgrp # cat cgroup.controllers
cpu memory # cpu and memory available in 'foo_cgrp'
/sys/fs/cgroup/foo_cgrp # cat cgroup.subtree_control # empty by default /sys/fs/cgroup/foo_cgrp # ls

cgroup.controllers      cpu.max.burst           memory.numa_stat
cgroup.events           cpu.pressure            memory.oom.group
cgroup.freeze           cpu.stat                memory.peak
cgroup.kill             cpu.stat.local          memory.pressure
cgroup.max.depth        cpu.weight              memory.reclaim
cgroup.max.descendants  cpu.weight.nice         memory.stat
cgroup.pressure         io.pressure             memory.swap.current
cgroup.procs            memory.current          memory.swap.events
cgroup.stat             memory.events           memory.swap.high
cgroup.subtree_control  memory.events.local     memory.swap.max
cgroup.threads          memory.high             memory.swap.peak
cgroup.type             memory.low              memory.zswap.current
cpu.idle                memory.max              memory.zswap.max
cpu.max                 memory.min              memory.zswap.writeback

Once a controller is available in a cgroup it can be used to resource control processes of the cgroup.

---
  Documentation/admin-guide/cgroup-v2.rst | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/admin-guide/cgroup-v2.rst +0 -0
index 1a16ce68a4d7..0e1686511c45 100644

Documentation/admin-guide/cgroup-v2.rst Controlling Controllers · line 442

Quoted 7 lines
Documentation/admin-guide/cgroup-v2.rst +2 -2
@@ -438,8 +438,8 @@ Controlling Controllers
  Enabling and Disabling
  ~~~~~~~~~~~~~~~~~~~~~
 
-Each cgroup has a "cgroup.controllers" file which lists all
-controllers available for the cgroup to enable::
+Each cgroup has a cgroup.controllers file, which lists all the controllers
+available for that cgroup and which can be enabled for its children.

I believe breaking the sentence into two separate components is actually making it less correct. There are implicit controllers that are always enabled and do not show up in cgroup.controllers. Prime examples are perf_event and freezer. IOW, only controllers that are available and need to be explicitly enabled will show up.

Cheers,
Longman

#9 lore raw
Quoted 51 lines · Waiman Long
Quoted 50 lines · Vishal Chourasia

The documentation for cgroup controller management has been updated to be more consistent regarding following concepts:

What does it mean to have controllers
1) available in a cgroup, vs.
2) enabled in a cgroup

Which has been clearly defined below in the documentation.

"Enabling a controller in a cgroup indicates that the distribution of the target resource across its immediate children will be controlled. Consider the following sub-hierarchy"

As an example, consider

/sys/fs/cgroup # cat cgroup.controllers
cpuset cpu io memory hugetlb pids misc
/sys/fs/cgroup # cat cgroup.subtree_control # No controllers by default /sys/fs/cgroup # echo +cpu +memory > cgroup.subtree_control /sys/fs/cgroup # cat cgroup.subtree_control
cpu memory                   # cpu and memory enabled in /sys/fs/cgroup /sys/fs/cgroup # mkdir foo_cgrp
/sys/fs/cgroup # cd foo_cgrp/
/sys/fs/cgroup/foo_cgrp # cat cgroup.controllers
cpu memory                   # cpu and memory available in 'foo_cgrp' /sys/fs/cgroup/foo_cgrp # cat cgroup.subtree_control  # empty by default /sys/fs/cgroup/foo_cgrp # ls
cgroup.controllers      cpu.max.burst           memory.numa_stat cgroup.events           cpu.pressure            memory.oom.group cgroup.freeze           cpu.stat                memory.peak cgroup.kill             cpu.stat.local          memory.pressure cgroup.max.depth        cpu.weight              memory.reclaim cgroup.max.descendants  cpu.weight.nice         memory.stat cgroup.pressure         io.pressure memory.swap.current cgroup.procs            memory.current memory.swap.events cgroup.stat             memory.events           memory.swap.high cgroup.subtree_control  memory.events.local     memory.swap.max cgroup.threads          memory.high             memory.swap.peak cgroup.type             memory.low memory.zswap.current cpu.idle                memory.max              memory.zswap.max cpu.max                 memory.min memory.zswap.writeback

Once a controller is available in a cgroup it can be used to resource control processes of the cgroup.

---
  Documentation/admin-guide/cgroup-v2.rst | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 14 lines
Quoted 10 lines
Documentation/admin-guide/cgroup-v2.rst +0 -0
index 1a16ce68a4d7..0e1686511c45 100644
@@ -438,8 +438,8 @@ Controlling Controllers

  Enabling and Disabling
  ~~~~~~~~~~~~~~~~~~~~~
  -Each cgroup has a "cgroup.controllers" file which lists all

Documentation/admin-guide/cgroup-v2.rst +1 -1
-controllers available for the cgroup to enable::
+Each cgroup has a cgroup.controllers file, which lists all the 
Quoted 2 lines

controllers
+available for that cgroup and which can be enabled for its children.

I believe breaking the sentence into two separate components is actually making it less correct. There are implicit controllers that are always enabled and do not show up in cgroup.controllers. Prime examples are perf_event and freezer. IOW, only controllers that are available and need to be explicitly enabled will show up.

A correction: The cgroup.controllers file shows the controllers that are available in the current cgroup and which have to be explicitly enabled in cgroup.subtree_control to make them available in the child cgroups.

Cheers,
Longman

#10 lore raw

Hi Longman,

Quoted 9 lines · Waiman Long
Quoted 6 lines · Waiman Long

I believe breaking the sentence into two separate components is actually making it less correct. There are implicit controllers that are always enabled and do not show up in cgroup.controllers. Prime examples are perf_event and freezer. IOW, only controllers that are available and need to be explicitly enabled will show up.

Quoted 4 lines

A correction: The cgroup.controllers file shows the controllers that are available in the current cgroup and which have to be explicitly enabled in cgroup.subtree_control to make them available in the child cgroups.

Thank you for pointing it out.

Vishal

Quoted 4 lines

Cheers,
Longman