History

blk-cgroup: show global disk stats in root cgroup io.stat

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.

Boris Burkov committed 6 years ago

Commit ef45fe41 parent cd1fc4b4 files · +58 −7Browse files

Showing the changes to include/linux (1 of 4 files). Show all

Unified · Split

include/linux/genhd.h+1−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #define disk_to_dev(disk) (&(disk)->part0.__dev)
2525 #define part_to_dev(part) (&((part)->__dev))
2626
27+extern const struct device_type disk_type;
2728 extern struct device_type part_type;
2829 extern struct class block_class;
2930

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t