diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2011-08-02 16:14:02 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2011-08-02 16:14:02 -0400 |
commit | 3d071cd313643cf82b1ce1ce4fdf08d63ad53964 (patch) | |
tree | 874c1683f32f07614aa123f6ca5cf6c2bd443704 /Documentation/cgroups/blkio-controller.txt | |
parent | cf8e98d15361f8c594da00a3f7a500787fc1a426 (diff) | |
parent | 02f8c6aee8df3cdc935e9bdd4f2d020306035dbe (diff) |
Merge tag 'v3.0' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus
Diffstat (limited to 'Documentation/cgroups/blkio-controller.txt')
-rw-r--r-- | Documentation/cgroups/blkio-controller.txt | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/Documentation/cgroups/blkio-controller.txt b/Documentation/cgroups/blkio-controller.txt index 465351d4cf85..84f0a15fc210 100644 --- a/Documentation/cgroups/blkio-controller.txt +++ b/Documentation/cgroups/blkio-controller.txt | |||
@@ -28,16 +28,19 @@ cgroups. Here is what you can do. | |||
28 | - Enable group scheduling in CFQ | 28 | - Enable group scheduling in CFQ |
29 | CONFIG_CFQ_GROUP_IOSCHED=y | 29 | CONFIG_CFQ_GROUP_IOSCHED=y |
30 | 30 | ||
31 | - Compile and boot into kernel and mount IO controller (blkio). | 31 | - Compile and boot into kernel and mount IO controller (blkio); see |
32 | cgroups.txt, Why are cgroups needed?. | ||
32 | 33 | ||
33 | mount -t cgroup -o blkio none /cgroup | 34 | mount -t tmpfs cgroup_root /sys/fs/cgroup |
35 | mkdir /sys/fs/cgroup/blkio | ||
36 | mount -t cgroup -o blkio none /sys/fs/cgroup/blkio | ||
34 | 37 | ||
35 | - Create two cgroups | 38 | - Create two cgroups |
36 | mkdir -p /cgroup/test1/ /cgroup/test2 | 39 | mkdir -p /sys/fs/cgroup/blkio/test1/ /sys/fs/cgroup/blkio/test2 |
37 | 40 | ||
38 | - Set weights of group test1 and test2 | 41 | - Set weights of group test1 and test2 |
39 | echo 1000 > /cgroup/test1/blkio.weight | 42 | echo 1000 > /sys/fs/cgroup/blkio/test1/blkio.weight |
40 | echo 500 > /cgroup/test2/blkio.weight | 43 | echo 500 > /sys/fs/cgroup/blkio/test2/blkio.weight |
41 | 44 | ||
42 | - Create two same size files (say 512MB each) on same disk (file1, file2) and | 45 | - Create two same size files (say 512MB each) on same disk (file1, file2) and |
43 | launch two dd threads in different cgroup to read those files. | 46 | launch two dd threads in different cgroup to read those files. |
@@ -46,12 +49,12 @@ cgroups. Here is what you can do. | |||
46 | echo 3 > /proc/sys/vm/drop_caches | 49 | echo 3 > /proc/sys/vm/drop_caches |
47 | 50 | ||
48 | dd if=/mnt/sdb/zerofile1 of=/dev/null & | 51 | dd if=/mnt/sdb/zerofile1 of=/dev/null & |
49 | echo $! > /cgroup/test1/tasks | 52 | echo $! > /sys/fs/cgroup/blkio/test1/tasks |
50 | cat /cgroup/test1/tasks | 53 | cat /sys/fs/cgroup/blkio/test1/tasks |
51 | 54 | ||
52 | dd if=/mnt/sdb/zerofile2 of=/dev/null & | 55 | dd if=/mnt/sdb/zerofile2 of=/dev/null & |
53 | echo $! > /cgroup/test2/tasks | 56 | echo $! > /sys/fs/cgroup/blkio/test2/tasks |
54 | cat /cgroup/test2/tasks | 57 | cat /sys/fs/cgroup/blkio/test2/tasks |
55 | 58 | ||
56 | - At macro level, first dd should finish first. To get more precise data, keep | 59 | - At macro level, first dd should finish first. To get more precise data, keep |
57 | on looking at (with the help of script), at blkio.disk_time and | 60 | on looking at (with the help of script), at blkio.disk_time and |
@@ -68,13 +71,13 @@ Throttling/Upper Limit policy | |||
68 | - Enable throttling in block layer | 71 | - Enable throttling in block layer |
69 | CONFIG_BLK_DEV_THROTTLING=y | 72 | CONFIG_BLK_DEV_THROTTLING=y |
70 | 73 | ||
71 | - Mount blkio controller | 74 | - Mount blkio controller (see cgroups.txt, Why are cgroups needed?) |
72 | mount -t cgroup -o blkio none /cgroup/blkio | 75 | mount -t cgroup -o blkio none /sys/fs/cgroup/blkio |
73 | 76 | ||
74 | - Specify a bandwidth rate on particular device for root group. The format | 77 | - Specify a bandwidth rate on particular device for root group. The format |
75 | for policy is "<major>:<minor> <byes_per_second>". | 78 | for policy is "<major>:<minor> <byes_per_second>". |
76 | 79 | ||
77 | echo "8:16 1048576" > /cgroup/blkio/blkio.read_bps_device | 80 | echo "8:16 1048576" > /sys/fs/cgroup/blkio/blkio.throttle.read_bps_device |
78 | 81 | ||
79 | Above will put a limit of 1MB/second on reads happening for root group | 82 | Above will put a limit of 1MB/second on reads happening for root group |
80 | on device having major/minor number 8:16. | 83 | on device having major/minor number 8:16. |
@@ -87,7 +90,7 @@ Throttling/Upper Limit policy | |||
87 | 1024+0 records out | 90 | 1024+0 records out |
88 | 4194304 bytes (4.2 MB) copied, 4.0001 s, 1.0 MB/s | 91 | 4194304 bytes (4.2 MB) copied, 4.0001 s, 1.0 MB/s |
89 | 92 | ||
90 | Limits for writes can be put using blkio.write_bps_device file. | 93 | Limits for writes can be put using blkio.throttle.write_bps_device file. |
91 | 94 | ||
92 | Hierarchical Cgroups | 95 | Hierarchical Cgroups |
93 | ==================== | 96 | ==================== |
@@ -108,7 +111,7 @@ Hierarchical Cgroups | |||
108 | CFQ and throttling will practically treat all groups at same level. | 111 | CFQ and throttling will practically treat all groups at same level. |
109 | 112 | ||
110 | pivot | 113 | pivot |
111 | / | \ \ | 114 | / / \ \ |
112 | root test1 test2 test3 | 115 | root test1 test2 test3 |
113 | 116 | ||
114 | Down the line we can implement hierarchical accounting/control support | 117 | Down the line we can implement hierarchical accounting/control support |
@@ -149,7 +152,7 @@ Proportional weight policy files | |||
149 | 152 | ||
150 | Following is the format. | 153 | Following is the format. |
151 | 154 | ||
152 | #echo dev_maj:dev_minor weight > /path/to/cgroup/blkio.weight_device | 155 | # echo dev_maj:dev_minor weight > blkio.weight_device |
153 | Configure weight=300 on /dev/sdb (8:16) in this cgroup | 156 | Configure weight=300 on /dev/sdb (8:16) in this cgroup |
154 | # echo 8:16 300 > blkio.weight_device | 157 | # echo 8:16 300 > blkio.weight_device |
155 | # cat blkio.weight_device | 158 | # cat blkio.weight_device |
@@ -283,28 +286,28 @@ Throttling/Upper limit policy files | |||
283 | specified in bytes per second. Rules are per deivce. Following is | 286 | specified in bytes per second. Rules are per deivce. Following is |
284 | the format. | 287 | the format. |
285 | 288 | ||
286 | echo "<major>:<minor> <rate_bytes_per_second>" > /cgrp/blkio.read_bps_device | 289 | echo "<major>:<minor> <rate_bytes_per_second>" > /cgrp/blkio.throttle.read_bps_device |
287 | 290 | ||
288 | - blkio.throttle.write_bps_device | 291 | - blkio.throttle.write_bps_device |
289 | - Specifies upper limit on WRITE rate to the device. IO rate is | 292 | - Specifies upper limit on WRITE rate to the device. IO rate is |
290 | specified in bytes per second. Rules are per deivce. Following is | 293 | specified in bytes per second. Rules are per deivce. Following is |
291 | the format. | 294 | the format. |
292 | 295 | ||
293 | echo "<major>:<minor> <rate_bytes_per_second>" > /cgrp/blkio.write_bps_device | 296 | echo "<major>:<minor> <rate_bytes_per_second>" > /cgrp/blkio.throttle.write_bps_device |
294 | 297 | ||
295 | - blkio.throttle.read_iops_device | 298 | - blkio.throttle.read_iops_device |
296 | - Specifies upper limit on READ rate from the device. IO rate is | 299 | - Specifies upper limit on READ rate from the device. IO rate is |
297 | specified in IO per second. Rules are per deivce. Following is | 300 | specified in IO per second. Rules are per deivce. Following is |
298 | the format. | 301 | the format. |
299 | 302 | ||
300 | echo "<major>:<minor> <rate_io_per_second>" > /cgrp/blkio.read_iops_device | 303 | echo "<major>:<minor> <rate_io_per_second>" > /cgrp/blkio.throttle.read_iops_device |
301 | 304 | ||
302 | - blkio.throttle.write_iops_device | 305 | - blkio.throttle.write_iops_device |
303 | - Specifies upper limit on WRITE rate to the device. IO rate is | 306 | - Specifies upper limit on WRITE rate to the device. IO rate is |
304 | specified in io per second. Rules are per deivce. Following is | 307 | specified in io per second. Rules are per deivce. Following is |
305 | the format. | 308 | the format. |
306 | 309 | ||
307 | echo "<major>:<minor> <rate_io_per_second>" > /cgrp/blkio.write_iops_device | 310 | echo "<major>:<minor> <rate_io_per_second>" > /cgrp/blkio.throttle.write_iops_device |
308 | 311 | ||
309 | Note: If both BW and IOPS rules are specified for a device, then IO is | 312 | Note: If both BW and IOPS rules are specified for a device, then IO is |
310 | subjectd to both the constraints. | 313 | subjectd to both the constraints. |