linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Documentation: cgroup: add section explaining controller availability
@ 2025-06-04  5:43 Vishal Chourasia
  2025-06-05  9:45 ` Michal Koutný
  0 siblings, 1 reply; 3+ messages in thread
From: Vishal Chourasia @ 2025-06-04  5:43 UTC (permalink / raw)
  To: Tejun Heo, Johannes Weiner, Michal Koutný, Jonathan Corbet,
	cgroups, linux-doc, linux-kernel, bagasdotme, llong
  Cc: Vishal Chourasia

A new documentation section titled "Availability" has been added to
describe the meaning of a controller being available in a cgroup,
complementing the existing "Enabling and Disabling" section.

This update improves the clarity of cgroup controller management by
explicitly distinguishing between:

1. Availability – when a controller is supported by the kernel and
   listed in "cgroup.controllers", making its interface files accessible
   in the cgroup's directory.
2. Enabling – when a controller is enabled via explicitly writing the
   name of the controller to "cgroup.subtree_control" to control
   distribution of resource across the cgroup's immediate children.

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 enabled by default
/sys/fs/cgroup # echo +cpu +memory > cgroup.subtree_control # enabling "cpu" and "memory"
/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

In this example, "cpu" and "memory" are enabled in the root cgroup,
making them available in "foo_cgrp". This exposes the corresponding
interface files in "foo_cgrp/", allowing resource control of processes
in that cgroup. However, these controllers are not yet enabled in
"foo_cgrp" itself.

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

Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
---
 Documentation/admin-guide/cgroup-v2.rst | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
index 0cc35a14afbe..202bf39867ea 100644
--- a/Documentation/admin-guide/cgroup-v2.rst
+++ b/Documentation/admin-guide/cgroup-v2.rst
@@ -435,6 +435,15 @@ both cgroups.
 Controlling Controllers
 -----------------------
 
+Availablity
+~~~~~~~~~~~
+
+A controller is available in a cgroup when it is supported by the kernel and
+listed in the "cgroup.controllers" file. Availability means the controller's
+interface files are exposed in the cgroup’s directory, allowing the
+distribution of the target resource to be observed or controlled within
+that cgroup.
+
 Enabling and Disabling
 ~~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Documentation: cgroup: add section explaining controller availability
  2025-06-04  5:43 [PATCH] Documentation: cgroup: add section explaining controller availability Vishal Chourasia
@ 2025-06-05  9:45 ` Michal Koutný
  2025-06-05 14:55   ` Vishal Chourasia
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Koutný @ 2025-06-05  9:45 UTC (permalink / raw)
  To: Vishal Chourasia
  Cc: Tejun Heo, Johannes Weiner, Jonathan Corbet, cgroups, linux-doc,
	linux-kernel, bagasdotme, llong

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]

On Wed, Jun 04, 2025 at 11:13:53AM +0530, Vishal Chourasia <vishalc@linux.ibm.com> wrote:
> +Availablity
> +~~~~~~~~~~~
> +
> +A controller is available in a cgroup when it is supported by the kernel and
+A controller is available in a cgroup when it is supported by the
+kernel (compiled, not disabled and not attached to a v1 hierarchy) and

Maybe this point about v1 exclusion. But altogether this section as
drafted looks sensible to me.

Thanks,
Michal

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Documentation: cgroup: add section explaining controller availability
  2025-06-05  9:45 ` Michal Koutný
@ 2025-06-05 14:55   ` Vishal Chourasia
  0 siblings, 0 replies; 3+ messages in thread
From: Vishal Chourasia @ 2025-06-05 14:55 UTC (permalink / raw)
  To: Michal Koutný
  Cc: Tejun Heo, Johannes Weiner, Jonathan Corbet, cgroups, linux-doc,
	linux-kernel, bagasdotme, llong

On 05/06/25 15:15, Michal Koutný wrote:
> On Wed, Jun 04, 2025 at 11:13:53AM +0530, Vishal Chourasia <vishalc@linux.ibm.com> wrote:
>> +Availablity
>> +~~~~~~~~~~~
>> +
>> +A controller is available in a cgroup when it is supported by the kernel and
> +A controller is available in a cgroup when it is supported by the
> +kernel (compiled, not disabled and not attached to a v1 hierarchy) and
>
> Maybe this point about v1 exclusion. But altogether this section as
> drafted looks sensible to me.

I will add this.

Thanks,
Vishal

>
> Thanks,
> Michal

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-05 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-04  5:43 [PATCH] Documentation: cgroup: add section explaining controller availability Vishal Chourasia
2025-06-05  9:45 ` Michal Koutný
2025-06-05 14:55   ` Vishal Chourasia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).