In order to improve consistency and usability in cgroup stat accounting, we would like to support the root cgroup's io.stat. Since the root cgroup has processes doing io even if the system has no explicitly created cgroups, we need to be careful to avoid overhead in that case. For that reason, the rstat algorithms don't handle the root cgroup, so just turning the file on wouldn't give correct statistics. To get around this, we simulate flushing the iostat struct by filling it out directly from global disk stats. The result is a root cgroup io.stat file consistent with both /proc/diskstats and io.stat. Note that in order to collect the disk stats, we needed to iterate over devices. To facilitate that, we had to change the linkage of a disk_type to external so that it can be used from blk-cgroup.c to iterate over disks.
Showing the changes to include/linux (1 of 4 files). Show all
Unified · Split
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | #define disk_to_dev(disk) (&(disk)->part0.__dev) |
| 25 | 25 | #define part_to_dev(part) (&((part)->__dev)) |
| 26 | 26 | |
| 27 | +extern const struct device_type disk_type; | |
| 27 | 28 | extern struct device_type part_type; |
| 28 | 29 | extern struct class block_class; |
| 29 | 30 | |