Public bug reported:
from kernel document,
https://www.kernel.org/doc/Documentation/cgroup-v1/blkio-controller.txt
```
Throttling/Upper Limit policy
-----------------------------
- Enable Block IO controller
CONFIG_BLK_CGROUP=y
- Enable throttling in block layer
CONFIG_BLK_DEV_THROTTLING=y
- 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>".
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.
# dd iflag=direct if=/mnt/common/zerofile of=/dev/null bs=4K count=1024
1024+0 records in
1024+0 records out
4194304 bytes (4.2 MB) copied, 4.0001 s, 1.0 MB/s
Limits for writes can be put using blkio.throttle.write_bps_device file.
```
tested with ubuntu 16.04(xenial) and seems throttle not working, but on
my virtual machine, ubuntu 14.04(trusty) works.
```
ubuntu16.04(xenial)
root@i-x3mn8m8i:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 253:0 0 20G 0 disk
`-vda1 253:1 0 20G 0 part /
vdb 253:16 0 1G 0 disk [SWAP]
root@i-x3mn8m8i:~# dd if=/dev/zero of=test.img bs=4k oflag=direct
^C16246+0 records in
16246+0 records out
66543616 bytes (67 MB, 63 MiB) copied, 3.15081 s, 21.1 MB/s
root@i-x3mn8m8i:~# echo 253:0 1000 >
/sys/fs/cgroup/blkio/blkio.throttle.write_iops_device
root@i-x3mn8m8i:~# dd if=/dev/zero of=test.img bs=4k oflag=direct
^C26702+0 records in
26702+0 records out
109371392 bytes (109 MB, 104 MiB) copied, 5.2413 s, 20.9 MB/s
ubuntu14.04(trusty)
root@i-ulhx27oo:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 253:0 0 20G 0 disk
`-vda1 253:1 0 20G 0 part /
vdb 253:16 0 1G 0 disk [SWAP]
root@i-ulhx27oo:~# dd if=/dev/zero of=test.img bs=4k oflag=direct
^C27679+0 records in
27679+0 records out
113373184 bytes (113 MB) copied, 5.43766 s, 20.8 MB/s
root@i-ulhx27oo:~# echo 253:0 1000 >
/sys/fs/cgroup/blkio/blkio.throttle.write_iops_device
root@i-ulhx27oo:~# dd if=/dev/zero of=test.img bs=4k oflag=direct
^C7553+0 records in
7553+0 records out
30937088 bytes (31 MB) copied, 7.60268 s, 4.1 MB/s
```
** Affects: linux (Ubuntu)
Importance: Undecided
Status: New
** Tags: blkio
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1760375
Title:
cgroup blkio throttle does not work on root group
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1760375/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs