diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-22 20:00:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-22 20:00:32 -0400 |
commit | e9dd2b6837e26fe202708cce5ea4bb4ee3e3482e (patch) | |
tree | f42fd892495bfc4cbb740d06b016d267c9c42d00 /Documentation/cgroups | |
parent | 4f3a29dadaf999a273f1e7fe2476595d0283eef3 (diff) | |
parent | b4627321e18582dcbdeb45d77df29d3177107c65 (diff) |
Merge branch 'for-2.6.37/core' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.37/core' of git://git.kernel.dk/linux-2.6-block: (39 commits)
cfq-iosched: Fix a gcc 4.5 warning and put some comments
block: Turn bvec_k{un,}map_irq() into static inline functions
block: fix accounting bug on cross partition merges
block: Make the integrity mapped property a bio flag
block: Fix double free in blk_integrity_unregister
block: Ensure physical block size is unsigned int
blkio-throttle: Fix possible multiplication overflow in iops calculations
blkio-throttle: limit max iops value to UINT_MAX
blkio-throttle: There is no need to convert jiffies to milli seconds
blkio-throttle: Fix link failure failure on i386
blkio: Recalculate the throttled bio dispatch time upon throttle limit change
blkio: Add root group to td->tg_list
blkio: deletion of a cgroup was causes oops
blkio: Do not export throttle files if CONFIG_BLK_DEV_THROTTLING=n
block: set the bounce_pfn to the actual DMA limit rather than to max memory
block: revert bad fix for memory hotplug causing bounces
Fix compile error in blk-exec.c for !CONFIG_DETECT_HUNG_TASK
block: set the bounce_pfn to the actual DMA limit rather than to max memory
block: Prevent hang_check firing during long I/O
cfq: improve fsync performance for small files
...
Fix up trivial conflicts due to __rcu sparse annotation in include/linux/genhd.h
Diffstat (limited to 'Documentation/cgroups')
-rw-r--r-- | Documentation/cgroups/blkio-controller.txt | 106 |
1 files changed, 103 insertions, 3 deletions
diff --git a/Documentation/cgroups/blkio-controller.txt b/Documentation/cgroups/blkio-controller.txt index 6919d62591d9..d6da611f8f63 100644 --- a/Documentation/cgroups/blkio-controller.txt +++ b/Documentation/cgroups/blkio-controller.txt | |||
@@ -8,12 +8,17 @@ both at leaf nodes as well as at intermediate nodes in a storage hierarchy. | |||
8 | Plan is to use the same cgroup based management interface for blkio controller | 8 | Plan is to use the same cgroup based management interface for blkio controller |
9 | and based on user options switch IO policies in the background. | 9 | and based on user options switch IO policies in the background. |
10 | 10 | ||
11 | In the first phase, this patchset implements proportional weight time based | 11 | Currently two IO control policies are implemented. First one is proportional |
12 | division of disk policy. It is implemented in CFQ. Hence this policy takes | 12 | weight time based division of disk policy. It is implemented in CFQ. Hence |
13 | effect only on leaf nodes when CFQ is being used. | 13 | this policy takes effect only on leaf nodes when CFQ is being used. The second |
14 | one is throttling policy which can be used to specify upper IO rate limits | ||
15 | on devices. This policy is implemented in generic block layer and can be | ||
16 | used on leaf nodes as well as higher level logical devices like device mapper. | ||
14 | 17 | ||
15 | HOWTO | 18 | HOWTO |
16 | ===== | 19 | ===== |
20 | Proportional Weight division of bandwidth | ||
21 | ----------------------------------------- | ||
17 | You can do a very simple testing of running two dd threads in two different | 22 | You can do a very simple testing of running two dd threads in two different |
18 | cgroups. Here is what you can do. | 23 | cgroups. Here is what you can do. |
19 | 24 | ||
@@ -55,6 +60,35 @@ cgroups. Here is what you can do. | |||
55 | group dispatched to the disk. We provide fairness in terms of disk time, so | 60 | group dispatched to the disk. We provide fairness in terms of disk time, so |
56 | ideally io.disk_time of cgroups should be in proportion to the weight. | 61 | ideally io.disk_time of cgroups should be in proportion to the weight. |
57 | 62 | ||
63 | Throttling/Upper Limit policy | ||
64 | ----------------------------- | ||
65 | - Enable Block IO controller | ||
66 | CONFIG_BLK_CGROUP=y | ||
67 | |||
68 | - Enable throttling in block layer | ||
69 | CONFIG_BLK_DEV_THROTTLING=y | ||
70 | |||
71 | - Mount blkio controller | ||
72 | mount -t cgroup -o blkio none /cgroup/blkio | ||
73 | |||
74 | - Specify a bandwidth rate on particular device for root group. The format | ||
75 | for policy is "<major>:<minor> <byes_per_second>". | ||
76 | |||
77 | echo "8:16 1048576" > /cgroup/blkio/blkio.read_bps_device | ||
78 | |||
79 | Above will put a limit of 1MB/second on reads happening for root group | ||
80 | on device having major/minor number 8:16. | ||
81 | |||
82 | - Run dd to read a file and see if rate is throttled to 1MB/s or not. | ||
83 | |||
84 | # dd if=/mnt/common/zerofile of=/dev/null bs=4K count=1024 | ||
85 | # iflag=direct | ||
86 | 1024+0 records in | ||
87 | 1024+0 records out | ||
88 | 4194304 bytes (4.2 MB) copied, 4.0001 s, 1.0 MB/s | ||
89 | |||
90 | Limits for writes can be put using blkio.write_bps_device file. | ||
91 | |||
58 | Various user visible config options | 92 | Various user visible config options |
59 | =================================== | 93 | =================================== |
60 | CONFIG_BLK_CGROUP | 94 | CONFIG_BLK_CGROUP |
@@ -68,8 +102,13 @@ CONFIG_CFQ_GROUP_IOSCHED | |||
68 | - Enables group scheduling in CFQ. Currently only 1 level of group | 102 | - Enables group scheduling in CFQ. Currently only 1 level of group |
69 | creation is allowed. | 103 | creation is allowed. |
70 | 104 | ||
105 | CONFIG_BLK_DEV_THROTTLING | ||
106 | - Enable block device throttling support in block layer. | ||
107 | |||
71 | Details of cgroup files | 108 | Details of cgroup files |
72 | ======================= | 109 | ======================= |
110 | Proportional weight policy files | ||
111 | -------------------------------- | ||
73 | - blkio.weight | 112 | - blkio.weight |
74 | - Specifies per cgroup weight. This is default weight of the group | 113 | - Specifies per cgroup weight. This is default weight of the group |
75 | on all the devices until and unless overridden by per device rule. | 114 | on all the devices until and unless overridden by per device rule. |
@@ -210,6 +249,67 @@ Details of cgroup files | |||
210 | and minor number of the device and third field specifies the number | 249 | and minor number of the device and third field specifies the number |
211 | of times a group was dequeued from a particular device. | 250 | of times a group was dequeued from a particular device. |
212 | 251 | ||
252 | Throttling/Upper limit policy files | ||
253 | ----------------------------------- | ||
254 | - blkio.throttle.read_bps_device | ||
255 | - Specifies upper limit on READ rate from the device. IO rate is | ||
256 | specified in bytes per second. Rules are per deivce. Following is | ||
257 | the format. | ||
258 | |||
259 | echo "<major>:<minor> <rate_bytes_per_second>" > /cgrp/blkio.read_bps_device | ||
260 | |||
261 | - blkio.throttle.write_bps_device | ||
262 | - Specifies upper limit on WRITE rate to the device. IO rate is | ||
263 | specified in bytes per second. Rules are per deivce. Following is | ||
264 | the format. | ||
265 | |||
266 | echo "<major>:<minor> <rate_bytes_per_second>" > /cgrp/blkio.write_bps_device | ||
267 | |||
268 | - blkio.throttle.read_iops_device | ||
269 | - Specifies upper limit on READ rate from the device. IO rate is | ||
270 | specified in IO per second. Rules are per deivce. Following is | ||
271 | the format. | ||
272 | |||
273 | echo "<major>:<minor> <rate_io_per_second>" > /cgrp/blkio.read_iops_device | ||
274 | |||
275 | - blkio.throttle.write_iops_device | ||
276 | - Specifies upper limit on WRITE rate to the device. IO rate is | ||
277 | specified in io per second. Rules are per deivce. Following is | ||
278 | the format. | ||
279 | |||
280 | echo "<major>:<minor> <rate_io_per_second>" > /cgrp/blkio.write_iops_device | ||
281 | |||
282 | Note: If both BW and IOPS rules are specified for a device, then IO is | ||
283 | subjectd to both the constraints. | ||
284 | |||
285 | - blkio.throttle.io_serviced | ||
286 | - Number of IOs (bio) completed to/from the disk by the group (as | ||
287 | seen by throttling policy). These are further divided by the type | ||
288 | of operation - read or write, sync or async. First two fields specify | ||
289 | the major and minor number of the device, third field specifies the | ||
290 | operation type and the fourth field specifies the number of IOs. | ||
291 | |||
292 | blkio.io_serviced does accounting as seen by CFQ and counts are in | ||
293 | number of requests (struct request). On the other hand, | ||
294 | blkio.throttle.io_serviced counts number of IO in terms of number | ||
295 | of bios as seen by throttling policy. These bios can later be | ||
296 | merged by elevator and total number of requests completed can be | ||
297 | lesser. | ||
298 | |||
299 | - blkio.throttle.io_service_bytes | ||
300 | - Number of bytes transferred to/from the disk by the group. These | ||
301 | are further divided by the type of operation - read or write, sync | ||
302 | or async. First two fields specify the major and minor number of the | ||
303 | device, third field specifies the operation type and the fourth field | ||
304 | specifies the number of bytes. | ||
305 | |||
306 | These numbers should roughly be same as blkio.io_service_bytes as | ||
307 | updated by CFQ. The difference between two is that | ||
308 | blkio.io_service_bytes will not be updated if CFQ is not operating | ||
309 | on request queue. | ||
310 | |||
311 | Common files among various policies | ||
312 | ----------------------------------- | ||
213 | - blkio.reset_stats | 313 | - blkio.reset_stats |
214 | - Writing an int to this file will result in resetting all the stats | 314 | - Writing an int to this file will result in resetting all the stats |
215 | for that cgroup. | 315 | for that cgroup. |