Skip to content

Commit efdf753

Browse files
Waiman-Longhtejun
authored andcommitted
cgroup/cpuset: Documentation update for partition
This patch updates the cgroup-v2.rst file to include information about the new "cpuset.cpus.exclusive" and "cpuset.cpus.excluisve.effective" control files as well as the new remote partition type. Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 4a74e41 commit efdf753

File tree

1 file changed

+91
-32
lines changed

1 file changed

+91
-32
lines changed

Documentation/admin-guide/cgroup-v2.rst

Lines changed: 91 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,49 @@ Cpuset Interface Files
22262226

22272227
Its value will be affected by memory nodes hotplug events.
22282228

2229+
cpuset.cpus.exclusive
2230+
A read-write multiple values file which exists on non-root
2231+
cpuset-enabled cgroups.
2232+
2233+
It lists all the exclusive CPUs that are allowed to be used
2234+
to create a new cpuset partition. Its value is not used
2235+
unless the cgroup becomes a valid partition root. See the
2236+
"cpuset.cpus.partition" section below for a description of what
2237+
a cpuset partition is.
2238+
2239+
When the cgroup becomes a partition root, the actual exclusive
2240+
CPUs that are allocated to that partition are listed in
2241+
"cpuset.cpus.exclusive.effective" which may be different
2242+
from "cpuset.cpus.exclusive". If "cpuset.cpus.exclusive"
2243+
has previously been set, "cpuset.cpus.exclusive.effective"
2244+
is always a subset of it.
2245+
2246+
Users can manually set it to a value that is different from
2247+
"cpuset.cpus". The only constraint in setting it is that the
2248+
list of CPUs must be exclusive with respect to its sibling.
2249+
2250+
For a parent cgroup, any one of its exclusive CPUs can only
2251+
be distributed to at most one of its child cgroups. Having an
2252+
exclusive CPU appearing in two or more of its child cgroups is
2253+
not allowed (the exclusivity rule). A value that violates the
2254+
exclusivity rule will be rejected with a write error.
2255+
2256+
The root cgroup is a partition root and all its available CPUs
2257+
are in its exclusive CPU set.
2258+
2259+
cpuset.cpus.exclusive.effective
2260+
A read-only multiple values file which exists on all non-root
2261+
cpuset-enabled cgroups.
2262+
2263+
This file shows the effective set of exclusive CPUs that
2264+
can be used to create a partition root. The content of this
2265+
file will always be a subset of "cpuset.cpus" and its parent's
2266+
"cpuset.cpus.exclusive.effective" if its parent is not the root
2267+
cgroup. It will also be a subset of "cpuset.cpus.exclusive"
2268+
if it is set. If "cpuset.cpus.exclusive" is not set, it is
2269+
treated to have an implicit value of "cpuset.cpus" in the
2270+
formation of local partition.
2271+
22292272
cpuset.cpus.partition
22302273
A read-write single value file which exists on non-root
22312274
cpuset-enabled cgroups. This flag is owned by the parent cgroup
@@ -2239,26 +2282,41 @@ Cpuset Interface Files
22392282
"isolated" Partition root without load balancing
22402283
========== =====================================
22412284

2242-
The root cgroup is always a partition root and its state
2243-
cannot be changed. All other non-root cgroups start out as
2244-
"member".
2285+
A cpuset partition is a collection of cpuset-enabled cgroups with
2286+
a partition root at the top of the hierarchy and its descendants
2287+
except those that are separate partition roots themselves and
2288+
their descendants. A partition has exclusive access to the
2289+
set of exclusive CPUs allocated to it. Other cgroups outside
2290+
of that partition cannot use any CPUs in that set.
2291+
2292+
There are two types of partitions - local and remote. A local
2293+
partition is one whose parent cgroup is also a valid partition
2294+
root. A remote partition is one whose parent cgroup is not a
2295+
valid partition root itself. Writing to "cpuset.cpus.exclusive"
2296+
is optional for the creation of a local partition as its
2297+
"cpuset.cpus.exclusive" file will assume an implicit value that
2298+
is the same as "cpuset.cpus" if it is not set. Writing the
2299+
proper "cpuset.cpus.exclusive" values down the cgroup hierarchy
2300+
before the target partition root is mandatory for the creation
2301+
of a remote partition.
2302+
2303+
Currently, a remote partition cannot be created under a local
2304+
partition. All the ancestors of a remote partition root except
2305+
the root cgroup cannot be a partition root.
2306+
2307+
The root cgroup is always a partition root and its state cannot
2308+
be changed. All other non-root cgroups start out as "member".
22452309

22462310
When set to "root", the current cgroup is the root of a new
2247-
partition or scheduling domain that comprises itself and all
2248-
its descendants except those that are separate partition roots
2249-
themselves and their descendants.
2311+
partition or scheduling domain. The set of exclusive CPUs is
2312+
determined by the value of its "cpuset.cpus.exclusive.effective".
22502313

2251-
When set to "isolated", the CPUs in that partition root will
2314+
When set to "isolated", the CPUs in that partition will
22522315
be in an isolated state without any load balancing from the
22532316
scheduler. Tasks placed in such a partition with multiple
22542317
CPUs should be carefully distributed and bound to each of the
22552318
individual CPUs for optimal performance.
22562319

2257-
The value shown in "cpuset.cpus.effective" of a partition root
2258-
is the CPUs that the partition root can dedicate to a potential
2259-
new child partition root. The new child subtracts available
2260-
CPUs from its parent "cpuset.cpus.effective".
2261-
22622320
A partition root ("root" or "isolated") can be in one of the
22632321
two possible states - valid or invalid. An invalid partition
22642322
root is in a degraded state where some state information may
@@ -2281,37 +2339,33 @@ Cpuset Interface Files
22812339
In the case of an invalid partition root, a descriptive string on
22822340
why the partition is invalid is included within parentheses.
22832341

2284-
For a partition root to become valid, the following conditions
2342+
For a local partition root to be valid, the following conditions
22852343
must be met.
22862344

2287-
1) The "cpuset.cpus" is exclusive with its siblings , i.e. they
2288-
are not shared by any of its siblings (exclusivity rule).
2289-
2) The parent cgroup is a valid partition root.
2290-
3) The "cpuset.cpus" is not empty and must contain at least
2291-
one of the CPUs from parent's "cpuset.cpus", i.e. they overlap.
2292-
4) The "cpuset.cpus.effective" cannot be empty unless there is
2345+
1) The parent cgroup is a valid partition root.
2346+
2) The "cpuset.cpus.exclusive.effective" file cannot be empty,
2347+
though it may contain offline CPUs.
2348+
3) The "cpuset.cpus.effective" cannot be empty unless there is
22932349
no task associated with this partition.
22942350

2295-
External events like hotplug or changes to "cpuset.cpus" can
2296-
cause a valid partition root to become invalid and vice versa.
2297-
Note that a task cannot be moved to a cgroup with empty
2298-
"cpuset.cpus.effective".
2351+
For a remote partition root to be valid, all the above conditions
2352+
except the first one must be met.
22992353

2300-
For a valid partition root with the sibling cpu exclusivity
2301-
rule enabled, changes made to "cpuset.cpus" that violate the
2302-
exclusivity rule will invalidate the partition as well as its
2303-
sibling partitions with conflicting cpuset.cpus values. So
2304-
care must be taking in changing "cpuset.cpus".
2354+
External events like hotplug or changes to "cpuset.cpus" or
2355+
"cpuset.cpus.exclusive" can cause a valid partition root to
2356+
become invalid and vice versa. Note that a task cannot be
2357+
moved to a cgroup with empty "cpuset.cpus.effective".
23052358

23062359
A valid non-root parent partition may distribute out all its CPUs
2307-
to its child partitions when there is no task associated with it.
2360+
to its child local partitions when there is no task associated
2361+
with it.
23082362

2309-
Care must be taken to change a valid partition root to
2310-
"member" as all its child partitions, if present, will become
2363+
Care must be taken to change a valid partition root to "member"
2364+
as all its child local partitions, if present, will become
23112365
invalid causing disruption to tasks running in those child
23122366
partitions. These inactivated partitions could be recovered if
23132367
their parent is switched back to a partition root with a proper
2314-
set of "cpuset.cpus".
2368+
value in "cpuset.cpus" or "cpuset.cpus.exclusive".
23152369

23162370
Poll and inotify events are triggered whenever the state of
23172371
"cpuset.cpus.partition" changes. That includes changes caused
@@ -2321,6 +2375,11 @@ Cpuset Interface Files
23212375
to "cpuset.cpus.partition" without the need to do continuous
23222376
polling.
23232377

2378+
A user can pre-configure certain CPUs to an isolated state
2379+
with load balancing disabled at boot time with the "isolcpus"
2380+
kernel boot command line option. If those CPUs are to be put
2381+
into a partition, they have to be used in an isolated partition.
2382+
23242383

23252384
Device controller
23262385
-----------------

0 commit comments

Comments
 (0)