[PATCH 2/2] cgroup, docs: Document interaction of RT processes with cpu controller

Shashank Balaji via B4 Relay posted 2 patches 9 months, 2 weeks ago
[PATCH 2/2] cgroup, docs: Document interaction of RT processes with cpu controller
Posted by Shashank Balaji via B4 Relay 9 months, 2 weeks ago
From: Shashank Balaji <shashank.mahadasyam@sony.com>

If the cpu controller is enabled in a CONFIG_RT_GROUP_SCHED
disabled setting, cpu.stat and cpu.pressure account for realtime
processes, and cpu.uclamp.{min, max} affect realtime processes as well.
None of the other interface files are affected by or affect realtime
processes.

Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
---
 Documentation/admin-guide/cgroup-v2.rst | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
index f293a13b42ed69e7c6bf5e974cb86e228411af4e..2c267f42e5fef9c4e2c3530ce73330d680b9b2dc 100644
--- a/Documentation/admin-guide/cgroup-v2.rst
+++ b/Documentation/admin-guide/cgroup-v2.rst
@@ -1095,7 +1095,9 @@ realtime processes irrespective of CONFIG_RT_GROUP_SCHED.
 CPU Interface Files
 ~~~~~~~~~~~~~~~~~~~
 
-All time durations are in microseconds.
+All time durations are in microseconds. Only cpu.stat and cpu.pressure account
+for realtime processes, and only cpu.uclamp.min and cpu.uclamp.max
+affect realtime processes.
 
   cpu.stat
 	A read-only flat-keyed file.
@@ -1115,6 +1117,9 @@ All time durations are in microseconds.
 	- nr_bursts
 	- burst_usec
 
+    The runtime of realtime processes is accounted for only by the usage_usec,
+	user_usec, and system_usec fields.
+
   cpu.weight
 	A read-write single value file which exists on non-root
 	cgroups.  The default is "100".
@@ -1158,8 +1163,9 @@ All time durations are in microseconds.
   cpu.pressure
 	A read-write nested-keyed file.
 
-	Shows pressure stall information for CPU. See
-	:ref:`Documentation/accounting/psi.rst <psi>` for details.
+	Shows pressure stall information for CPU, including the contribution of
+	realtime processes. See :ref:`Documentation/accounting/psi.rst <psi>`
+	for details.
 
   cpu.uclamp.min
         A read-write single value file which exists on non-root cgroups.
@@ -1170,7 +1176,8 @@ All time durations are in microseconds.
 
         This interface allows reading and setting minimum utilization clamp
         values similar to the sched_setattr(2). This minimum utilization
-        value is used to clamp the task specific minimum utilization clamp.
+        value is used to clamp the task specific minimum utilization clamp,
+        including those of realtime processes.
 
         The requested minimum utilization (protection) is always capped by
         the current value for the maximum utilization (limit), i.e.
@@ -1185,7 +1192,8 @@ All time durations are in microseconds.
 
         This interface allows reading and setting maximum utilization clamp
         values similar to the sched_setattr(2). This maximum utilization
-        value is used to clamp the task specific maximum utilization clamp.
+        value is used to clamp the task specific maximum utilization clamp,
+        including those of realtime processes.
 
   cpu.idle
 	A read-write single value file which exists on non-root cgroups.

-- 
2.43.0
Re: [PATCH 2/2] cgroup, docs: Document interaction of RT processes with cpu controller
Posted by Michal Koutný 9 months, 2 weeks ago
Hello Shashank.

On Wed, Mar 05, 2025 at 01:12:44PM +0900, Shashank Balaji via B4 Relay <devnull+shashank.mahadasyam.sony.com@kernel.org> wrote:
> From: Shashank Balaji <shashank.mahadasyam@sony.com>
> 
> If the cpu controller is enabled in a CONFIG_RT_GROUP_SCHED
> disabled setting, cpu.stat and cpu.pressure account for realtime
> processes, and cpu.uclamp.{min, max} affect realtime processes as well.
> None of the other interface files are affected by or affect realtime
> processes.

I'm not sure the changed formulation make it clearer.
What was the unexpected value with !CONFIG_RT_GROUP_SCHED that made you
change this docs?

(Please note the docs is for generic cgroup, not only root cgroup.)

Michal
Re: [PATCH 2/2] cgroup, docs: Document interaction of RT processes with cpu controller
Posted by Waiman Long 9 months, 2 weeks ago
On 3/4/25 11:12 PM, Shashank Balaji via B4 Relay wrote:
> From: Shashank Balaji <shashank.mahadasyam@sony.com>
>
> If the cpu controller is enabled in a CONFIG_RT_GROUP_SCHED
> disabled setting, cpu.stat and cpu.pressure account for realtime
> processes, and cpu.uclamp.{min, max} affect realtime processes as well.
> None of the other interface files are affected by or affect realtime
> processes.
>
> Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
> ---
>   Documentation/admin-guide/cgroup-v2.rst | 18 +++++++++++++-----
>   1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
> index f293a13b42ed69e7c6bf5e974cb86e228411af4e..2c267f42e5fef9c4e2c3530ce73330d680b9b2dc 100644
> --- a/Documentation/admin-guide/cgroup-v2.rst
> +++ b/Documentation/admin-guide/cgroup-v2.rst
> @@ -1095,7 +1095,9 @@ realtime processes irrespective of CONFIG_RT_GROUP_SCHED.
>   CPU Interface Files
>   ~~~~~~~~~~~~~~~~~~~
>   
> -All time durations are in microseconds.
> +All time durations are in microseconds. Only cpu.stat and cpu.pressure account
> +for realtime processes, and only cpu.uclamp.min and cpu.uclamp.max
> +affect realtime processes.
>   
>     cpu.stat
>   	A read-only flat-keyed file.
> @@ -1115,6 +1117,9 @@ All time durations are in microseconds.
>   	- nr_bursts
>   	- burst_usec
>   
> +    The runtime of realtime processes is accounted for only by the usage_usec,
> +	user_usec, and system_usec fields.
> +

Alignment problem!

Anyway, I am not familiar enough with these cpu control files to give a 
review yet.

Cheers,
Longman

>     cpu.weight
>   	A read-write single value file which exists on non-root
>   	cgroups.  The default is "100".
> @@ -1158,8 +1163,9 @@ All time durations are in microseconds.
>     cpu.pressure
>   	A read-write nested-keyed file.
>   
> -	Shows pressure stall information for CPU. See
> -	:ref:`Documentation/accounting/psi.rst <psi>` for details.
> +	Shows pressure stall information for CPU, including the contribution of
> +	realtime processes. See :ref:`Documentation/accounting/psi.rst <psi>`
> +	for details.
>   
>     cpu.uclamp.min
>           A read-write single value file which exists on non-root cgroups.
> @@ -1170,7 +1176,8 @@ All time durations are in microseconds.
>   
>           This interface allows reading and setting minimum utilization clamp
>           values similar to the sched_setattr(2). This minimum utilization
> -        value is used to clamp the task specific minimum utilization clamp.
> +        value is used to clamp the task specific minimum utilization clamp,
> +        including those of realtime processes.
>   
>           The requested minimum utilization (protection) is always capped by
>           the current value for the maximum utilization (limit), i.e.
> @@ -1185,7 +1192,8 @@ All time durations are in microseconds.
>   
>           This interface allows reading and setting maximum utilization clamp
>           values similar to the sched_setattr(2). This maximum utilization
> -        value is used to clamp the task specific maximum utilization clamp.
> +        value is used to clamp the task specific maximum utilization clamp,
> +        including those of realtime processes.
>   
>     cpu.idle
>   	A read-write single value file which exists on non-root cgroups.
>