Skip to content

Commit d16e799

Browse files
shashank-mahadasyamhtejun
authored andcommitted
cgroup, docs: cpu controller's interaction with various scheduling policies
The cpu controller interface files account for or affect processes differently based on their scheduling policy, and the underlying scheduler used (fair-class vs. BPF scheduler). Document these differences Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 79bfa4b commit d16e799

1 file changed

Lines changed: 37 additions & 4 deletions

File tree

Documentation/admin-guide/cgroup-v2.rst

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,19 +1095,34 @@ realtime processes irrespective of CONFIG_RT_GROUP_SCHED.
10951095
CPU Interface Files
10961096
~~~~~~~~~~~~~~~~~~~
10971097

1098-
All time durations are in microseconds.
1098+
The interaction of a process with the cpu controller depends on its scheduling
1099+
policy and the underlying scheduler. From the point of view of the cpu controller,
1100+
processes can be categorized as follows:
1101+
1102+
* Processes under the fair-class scheduler
1103+
* Processes under a BPF scheduler with the ``cgroup_set_weight`` callback
1104+
* Everything else: ``SCHED_{FIFO,RR,DEADLINE}`` and processes under a BPF scheduler
1105+
without the ``cgroup_set_weight`` callback
1106+
1107+
For details on when a process is under the fair-class scheduler or a BPF scheduler,
1108+
check out :ref:`Documentation/scheduler/sched-ext.rst <sched-ext>`.
1109+
1110+
For each of the following interface files, the above categories
1111+
will be referred to. All time durations are in microseconds.
10991112

11001113
cpu.stat
11011114
A read-only flat-keyed file.
11021115
This file exists whether the controller is enabled or not.
11031116

1104-
It always reports the following three stats:
1117+
It always reports the following three stats, which account for all the
1118+
processes in the cgroup:
11051119

11061120
- usage_usec
11071121
- user_usec
11081122
- system_usec
11091123

1110-
and the following five when the controller is enabled:
1124+
and the following five when the controller is enabled, which account for
1125+
only the processes under the fair-class scheduler:
11111126

11121127
- nr_periods
11131128
- nr_throttled
@@ -1125,6 +1140,10 @@ All time durations are in microseconds.
11251140
If the cgroup has been configured to be SCHED_IDLE (cpu.idle = 1),
11261141
then the weight will show as a 0.
11271142

1143+
This file affects only processes under the fair-class scheduler and a BPF
1144+
scheduler with the ``cgroup_set_weight`` callback depending on what the
1145+
callback actually does.
1146+
11281147
cpu.weight.nice
11291148
A read-write single value file which exists on non-root
11301149
cgroups. The default is "0".
@@ -1137,6 +1156,10 @@ All time durations are in microseconds.
11371156
granularity is coarser for the nice values, the read value is
11381157
the closest approximation of the current weight.
11391158

1159+
This file affects only processes under the fair-class scheduler and a BPF
1160+
scheduler with the ``cgroup_set_weight`` callback depending on what the
1161+
callback actually does.
1162+
11401163
cpu.max
11411164
A read-write two value file which exists on non-root cgroups.
11421165
The default is "max 100000".
@@ -1149,18 +1172,24 @@ All time durations are in microseconds.
11491172
$PERIOD duration. "max" for $MAX indicates no limit. If only
11501173
one number is written, $MAX is updated.
11511174

1175+
This file affects only processes under the fair-class scheduler.
1176+
11521177
cpu.max.burst
11531178
A read-write single value file which exists on non-root
11541179
cgroups. The default is "0".
11551180

11561181
The burst in the range [0, $MAX].
11571182

1183+
This file affects only processes under the fair-class scheduler.
1184+
11581185
cpu.pressure
11591186
A read-write nested-keyed file.
11601187

11611188
Shows pressure stall information for CPU. See
11621189
:ref:`Documentation/accounting/psi.rst <psi>` for details.
11631190

1191+
This file accounts for all the processes in the cgroup.
1192+
11641193
cpu.uclamp.min
11651194
A read-write single value file which exists on non-root cgroups.
11661195
The default is "0", i.e. no utilization boosting.
@@ -1177,6 +1206,8 @@ All time durations are in microseconds.
11771206
the current value for the maximum utilization (limit), i.e.
11781207
`cpu.uclamp.max`.
11791208

1209+
This file affects all the processes in the cgroup.
1210+
11801211
cpu.uclamp.max
11811212
A read-write single value file which exists on non-root cgroups.
11821213
The default is "max". i.e. no utilization capping
@@ -1189,6 +1220,8 @@ All time durations are in microseconds.
11891220
value is used to clamp the task specific maximum utilization clamp,
11901221
including those of realtime processes.
11911222

1223+
This file affects all the processes in the cgroup.
1224+
11921225
cpu.idle
11931226
A read-write single value file which exists on non-root cgroups.
11941227
The default is 0.
@@ -1199,7 +1232,7 @@ All time durations are in microseconds.
11991232
own relative priorities, but the cgroup itself will be treated as
12001233
very low priority relative to its peers.
12011234

1202-
1235+
This file affects only processes under the fair-class scheduler.
12031236

12041237
Memory
12051238
------

0 commit comments

Comments
 (0)