Skip to content

Commit 8cbfdc2

Browse files
Waiman-Longhtejun
authored andcommitted
cgroup/cpuset: Update description of cpuset.cpus.partition in cgroup-v2.rst
Update Documentation/admin-guide/cgroup-v2.rst on the newly introduced "isolated" cpuset partition type as well as other changes made in other cpuset patches. Signed-off-by: Waiman Long <[email protected]> Reported-by: kernel test robot <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent d7c8142 commit 8cbfdc2

File tree

1 file changed

+87
-69
lines changed

1 file changed

+87
-69
lines changed

Documentation/admin-guide/cgroup-v2.rst

Lines changed: 87 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,75 +2185,93 @@ Cpuset Interface Files
21852185

21862186
It accepts only the following input values when written to.
21872187

2188-
======== ================================
2189-
"root" a partition root
2190-
"member" a non-root member of a partition
2191-
======== ================================
2192-
2193-
When set to be a partition root, the current cgroup is the
2194-
root of a new partition or scheduling domain that comprises
2195-
itself and all its descendants except those that are separate
2196-
partition roots themselves and their descendants. The root
2197-
cgroup is always a partition root.
2198-
2199-
There are constraints on where a partition root can be set.
2200-
It can only be set in a cgroup if all the following conditions
2201-
are true.
2202-
2203-
1) The "cpuset.cpus" is not empty and the list of CPUs are
2204-
exclusive, i.e. they are not shared by any of its siblings.
2205-
2) The parent cgroup is a partition root.
2206-
3) The "cpuset.cpus" is also a proper subset of the parent's
2207-
"cpuset.cpus.effective".
2208-
4) There is no child cgroups with cpuset enabled. This is for
2209-
eliminating corner cases that have to be handled if such a
2210-
condition is allowed.
2211-
2212-
Setting it to partition root will take the CPUs away from the
2213-
effective CPUs of the parent cgroup. Once it is set, this
2214-
file cannot be reverted back to "member" if there are any child
2215-
cgroups with cpuset enabled.
2216-
2217-
A parent partition cannot distribute all its CPUs to its
2218-
child partitions. There must be at least one cpu left in the
2219-
parent partition.
2220-
2221-
Once becoming a partition root, changes to "cpuset.cpus" is
2222-
generally allowed as long as the first condition above is true,
2223-
the change will not take away all the CPUs from the parent
2224-
partition and the new "cpuset.cpus" value is a superset of its
2225-
children's "cpuset.cpus" values.
2226-
2227-
Sometimes, external factors like changes to ancestors'
2228-
"cpuset.cpus" or cpu hotplug can cause the state of the partition
2229-
root to change. On read, the "cpuset.sched.partition" file
2230-
can show the following values.
2231-
2232-
============== ==============================
2233-
"member" Non-root member of a partition
2234-
"root" Partition root
2235-
"root invalid" Invalid partition root
2236-
============== ==============================
2237-
2238-
It is a partition root if the first 2 partition root conditions
2239-
above are true and at least one CPU from "cpuset.cpus" is
2240-
granted by the parent cgroup.
2241-
2242-
A partition root can become invalid if none of CPUs requested
2243-
in "cpuset.cpus" can be granted by the parent cgroup or the
2244-
parent cgroup is no longer a partition root itself. In this
2245-
case, it is not a real partition even though the restriction
2246-
of the first partition root condition above will still apply.
2247-
The cpu affinity of all the tasks in the cgroup will then be
2248-
associated with CPUs in the nearest ancestor partition.
2249-
2250-
An invalid partition root can be transitioned back to a
2251-
real partition root if at least one of the requested CPUs
2252-
can now be granted by its parent. In this case, the cpu
2253-
affinity of all the tasks in the formerly invalid partition
2254-
will be associated to the CPUs of the newly formed partition.
2255-
Changing the partition state of an invalid partition root to
2256-
"member" is always allowed even if child cpusets are present.
2188+
========== =====================================
2189+
"member" Non-root member of a partition
2190+
"root" Partition root
2191+
"isolated" Partition root without load balancing
2192+
========== =====================================
2193+
2194+
The root cgroup is always a partition root and its state
2195+
cannot be changed. All other non-root cgroups start out as
2196+
"member".
2197+
2198+
When set to "root", the current cgroup is the root of a new
2199+
partition or scheduling domain that comprises itself and all
2200+
its descendants except those that are separate partition roots
2201+
themselves and their descendants.
2202+
2203+
When set to "isolated", the CPUs in that partition root will
2204+
be in an isolated state without any load balancing from the
2205+
scheduler. Tasks placed in such a partition with multiple
2206+
CPUs should be carefully distributed and bound to each of the
2207+
individual CPUs for optimal performance.
2208+
2209+
The value shown in "cpuset.cpus.effective" of a partition root
2210+
is the CPUs that the partition root can dedicate to a potential
2211+
new child partition root. The new child subtracts available
2212+
CPUs from its parent "cpuset.cpus.effective".
2213+
2214+
A partition root ("root" or "isolated") can be in one of the
2215+
two possible states - valid or invalid. An invalid partition
2216+
root is in a degraded state where some state information may
2217+
be retained, but behaves more like a "member".
2218+
2219+
All possible state transitions among "member", "root" and
2220+
"isolated" are allowed.
2221+
2222+
On read, the "cpuset.cpus.partition" file can show the following
2223+
values.
2224+
2225+
============================= =====================================
2226+
"member" Non-root member of a partition
2227+
"root" Partition root
2228+
"isolated" Partition root without load balancing
2229+
"root invalid (<reason>)" Invalid partition root
2230+
"isolated invalid (<reason>)" Invalid isolated partition root
2231+
============================= =====================================
2232+
2233+
In the case of an invalid partition root, a descriptive string on
2234+
why the partition is invalid is included within parentheses.
2235+
2236+
For a partition root to become valid, the following conditions
2237+
must be met.
2238+
2239+
1) The "cpuset.cpus" is exclusive with its siblings , i.e. they
2240+
are not shared by any of its siblings (exclusivity rule).
2241+
2) The parent cgroup is a valid partition root.
2242+
3) The "cpuset.cpus" is not empty and must contain at least
2243+
one of the CPUs from parent's "cpuset.cpus", i.e. they overlap.
2244+
4) The "cpuset.cpus.effective" cannot be empty unless there is
2245+
no task associated with this partition.
2246+
2247+
External events like hotplug or changes to "cpuset.cpus" can
2248+
cause a valid partition root to become invalid and vice versa.
2249+
Note that a task cannot be moved to a cgroup with empty
2250+
"cpuset.cpus.effective".
2251+
2252+
For a valid partition root with the sibling cpu exclusivity
2253+
rule enabled, changes made to "cpuset.cpus" that violate the
2254+
exclusivity rule will invalidate the partition as well as its
2255+
sibiling partitions with conflicting cpuset.cpus values. So
2256+
care must be taking in changing "cpuset.cpus".
2257+
2258+
A valid non-root parent partition may distribute out all its CPUs
2259+
to its child partitions when there is no task associated with it.
2260+
2261+
Care must be taken to change a valid partition root to
2262+
"member" as all its child partitions, if present, will become
2263+
invalid causing disruption to tasks running in those child
2264+
partitions. These inactivated partitions could be recovered if
2265+
their parent is switched back to a partition root with a proper
2266+
set of "cpuset.cpus".
2267+
2268+
Poll and inotify events are triggered whenever the state of
2269+
"cpuset.cpus.partition" changes. That includes changes caused
2270+
by write to "cpuset.cpus.partition", cpu hotplug or other
2271+
changes that modify the validity status of the partition.
2272+
This will allow user space agents to monitor unexpected changes
2273+
to "cpuset.cpus.partition" without the need to do continuous
2274+
polling.
22572275

22582276

22592277
Device controller

0 commit comments

Comments
 (0)