Skip to content

Commit

Permalink
docs: cgroup-v1: convert docs to ReST and rename to *.rst
Browse files Browse the repository at this point in the history
Convert the cgroup-v1 files to ReST format, in order to
allow a later addition to the admin-guide.

The conversion is actually:
  - add blank lines and identation in order to identify paragraphs;
  - fix tables markups;
  - add some lists markups;
  - mark literal blocks;
  - adjust title markups.

At its new index.rst, let's add a :orphan: while this is not linked to
the main index.rst file, in order to avoid build warnings.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Acked-by: Tejun Heo <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
  • Loading branch information
mchehab authored and htejun committed Jun 14, 2019
1 parent 38cf3a6 commit 99c8b23
Show file tree
Hide file tree
Showing 34 changed files with 966 additions and 648 deletions.
2 changes: 1 addition & 1 deletion Documentation/admin-guide/hw-vuln/l1tf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ Guest mitigation mechanisms
For further information about confining guests to a single or to a group
of cores consult the cpusets documentation:

https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt
https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.rst

.. _interrupt_isolation:

Expand Down
4 changes: 2 additions & 2 deletions Documentation/admin-guide/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4078,7 +4078,7 @@

relax_domain_level=
[KNL, SMP] Set scheduler's default relax_domain_level.
See Documentation/cgroup-v1/cpusets.txt.
See Documentation/cgroup-v1/cpusets.rst.

reserve= [KNL,BUGS] Force kernel to ignore I/O ports or memory
Format: <base1>,<size1>[,<base2>,<size2>,...]
Expand Down Expand Up @@ -4588,7 +4588,7 @@
swapaccount=[0|1]
[KNL] Enable accounting of swap in memory resource
controller if no parameter or 1 is given or disable
it if 0 is given (See Documentation/cgroup-v1/memory.txt)
it if 0 is given (See Documentation/cgroup-v1/memory.rst)

swiotlb= [ARM,IA-64,PPC,MIPS,X86]
Format: { <int> | force | noforce }
Expand Down
2 changes: 1 addition & 1 deletion Documentation/admin-guide/mm/numa_memory_policy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ document attempts to describe the concepts and APIs of the 2.6 memory policy
support.

Memory policies should not be confused with cpusets
(``Documentation/cgroup-v1/cpusets.txt``)
(``Documentation/cgroup-v1/cpusets.rst``)
which is an administrative mechanism for restricting the nodes from which
memory may be allocated by a set of processes. Memory policies are a
programming interface that a NUMA-aware application can take advantage of. When
Expand Down
2 changes: 1 addition & 1 deletion Documentation/block/bfq-iosched.txt
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ As for cgroups-v1 (blkio controller), the exact set of stat files
created, and kept up-to-date by bfq, depends on whether
CONFIG_DEBUG_BLK_CGROUP is set. If it is set, then bfq creates all
the stat files documented in
Documentation/cgroup-v1/blkio-controller.txt. If, instead,
Documentation/cgroup-v1/blkio-controller.rst. If, instead,
CONFIG_DEBUG_BLK_CGROUP is not set, then bfq creates only the files
blkio.bfq.io_service_bytes
blkio.bfq.io_service_bytes_recursive
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Block IO Controller
===================
===================
Block IO Controller
===================

Overview
========
cgroup subsys "blkio" implements the block io controller. There seems to be
Expand All @@ -22,28 +24,35 @@ Proportional Weight division of bandwidth
You can do a very simple testing of running two dd threads in two different
cgroups. Here is what you can do.

- Enable Block IO controller
- Enable Block IO controller::

CONFIG_BLK_CGROUP=y

- Enable group scheduling in CFQ
- Enable group scheduling in CFQ:


CONFIG_CFQ_GROUP_IOSCHED=y

- Compile and boot into kernel and mount IO controller (blkio); see
cgroups.txt, Why are cgroups needed?.

::

mount -t tmpfs cgroup_root /sys/fs/cgroup
mkdir /sys/fs/cgroup/blkio
mount -t cgroup -o blkio none /sys/fs/cgroup/blkio

- Create two cgroups
- Create two cgroups::

mkdir -p /sys/fs/cgroup/blkio/test1/ /sys/fs/cgroup/blkio/test2

- Set weights of group test1 and test2
- Set weights of group test1 and test2::

echo 1000 > /sys/fs/cgroup/blkio/test1/blkio.weight
echo 500 > /sys/fs/cgroup/blkio/test2/blkio.weight

- Create two same size files (say 512MB each) on same disk (file1, file2) and
launch two dd threads in different cgroup to read those files.
launch two dd threads in different cgroup to read those files::

sync
echo 3 > /proc/sys/vm/drop_caches
Expand All @@ -65,24 +74,27 @@ cgroups. Here is what you can do.

Throttling/Upper Limit policy
-----------------------------
- Enable Block IO controller
- Enable Block IO controller::

CONFIG_BLK_CGROUP=y

- Enable throttling in block layer
- Enable throttling in block layer::

CONFIG_BLK_DEV_THROTTLING=y

- Mount blkio controller (see cgroups.txt, Why are cgroups needed?)
- Mount blkio controller (see cgroups.txt, Why are cgroups needed?)::

mount -t cgroup -o blkio none /sys/fs/cgroup/blkio

- Specify a bandwidth rate on particular device for root group. The format
for policy is "<major>:<minor> <bytes_per_second>".
for policy is "<major>:<minor> <bytes_per_second>"::

echo "8:16 1048576" > /sys/fs/cgroup/blkio/blkio.throttle.read_bps_device

Above will put a limit of 1MB/second on reads happening for root group
on device having major/minor number 8:16.

- Run dd to read a file and see if rate is throttled to 1MB/s or not.
- Run dd to read a file and see if rate is throttled to 1MB/s or not::

# dd iflag=direct if=/mnt/common/zerofile of=/dev/null bs=4K count=1024
1024+0 records in
Expand All @@ -99,7 +111,7 @@ throttling's hierarchy support is enabled iff "sane_behavior" is
enabled from cgroup side, which currently is a development option and
not publicly available.

If somebody created a hierarchy like as follows.
If somebody created a hierarchy like as follows::

root
/ \
Expand All @@ -115,7 +127,7 @@ directly generated by tasks in that cgroup.

Throttling without "sane_behavior" enabled from cgroup side will
practically treat all groups at same level as if it looks like the
following.
following::

pivot
/ / \ \
Expand Down Expand Up @@ -152,27 +164,31 @@ Proportional weight policy files
These rules override the default value of group weight as specified
by blkio.weight.

Following is the format.
Following is the format::

# echo dev_maj:dev_minor weight > blkio.weight_device

Configure weight=300 on /dev/sdb (8:16) in this cgroup::

# echo 8:16 300 > blkio.weight_device
# cat blkio.weight_device
dev weight
8:16 300

Configure weight=500 on /dev/sda (8:0) in this cgroup::

# echo dev_maj:dev_minor weight > blkio.weight_device
Configure weight=300 on /dev/sdb (8:16) in this cgroup
# echo 8:16 300 > blkio.weight_device
# cat blkio.weight_device
dev weight
8:16 300
# echo 8:0 500 > blkio.weight_device
# cat blkio.weight_device
dev weight
8:0 500
8:16 300

Configure weight=500 on /dev/sda (8:0) in this cgroup
# echo 8:0 500 > blkio.weight_device
# cat blkio.weight_device
dev weight
8:0 500
8:16 300
Remove specific weight for /dev/sda in this cgroup::

Remove specific weight for /dev/sda in this cgroup
# echo 8:0 0 > blkio.weight_device
# cat blkio.weight_device
dev weight
8:16 300
# echo 8:0 0 > blkio.weight_device
# cat blkio.weight_device
dev weight
8:16 300

- blkio.leaf_weight[_device]
- Equivalents of blkio.weight[_device] for the purpose of
Expand Down Expand Up @@ -297,30 +313,30 @@ Throttling/Upper limit policy files
- blkio.throttle.read_bps_device
- Specifies upper limit on READ rate from the device. IO rate is
specified in bytes per second. Rules are per device. Following is
the format.
the format::

echo "<major>:<minor> <rate_bytes_per_second>" > /cgrp/blkio.throttle.read_bps_device
echo "<major>:<minor> <rate_bytes_per_second>" > /cgrp/blkio.throttle.read_bps_device

- blkio.throttle.write_bps_device
- Specifies upper limit on WRITE rate to the device. IO rate is
specified in bytes per second. Rules are per device. Following is
the format.
the format::

echo "<major>:<minor> <rate_bytes_per_second>" > /cgrp/blkio.throttle.write_bps_device
echo "<major>:<minor> <rate_bytes_per_second>" > /cgrp/blkio.throttle.write_bps_device

- blkio.throttle.read_iops_device
- Specifies upper limit on READ rate from the device. IO rate is
specified in IO per second. Rules are per device. Following is
the format.
the format::

echo "<major>:<minor> <rate_io_per_second>" > /cgrp/blkio.throttle.read_iops_device
echo "<major>:<minor> <rate_io_per_second>" > /cgrp/blkio.throttle.read_iops_device

- blkio.throttle.write_iops_device
- Specifies upper limit on WRITE rate to the device. IO rate is
specified in io per second. Rules are per device. Following is
the format.
the format::

echo "<major>:<minor> <rate_io_per_second>" > /cgrp/blkio.throttle.write_iops_device
echo "<major>:<minor> <rate_io_per_second>" > /cgrp/blkio.throttle.write_iops_device

Note: If both BW and IOPS rules are specified for a device, then IO is
subjected to both the constraints.
Expand Down
Loading

0 comments on commit 99c8b23

Please sign in to comment.