I've noticed that when I look at the output of
/proc/diskstats there is a discrepancy between the total time spent reading, the total time spent writing, and the total time performing IO. For example, I saw an entry in
/proc/diskstats that was:
$ cat /proc/diskstats ... 8 0 sda 944150584 590524 235547588959 780672196 833280352 534699043 322507689696 3472000824 1 812190100 4246357772 ...
According to the documentation at https://www.kernel.org/doc/Documentation/iostats.txt,
Field 4 -- # of milliseconds spent reading This is the total number of milliseconds spent by all reads (as measured from __make_request() to end_that_request_last()).
Field 8 -- # of milliseconds spent writing This is the total number of milliseconds spent by all writes (as measured from __make_request() to end_that_request_last()).
Field 10 -- # of milliseconds spent doing I/Os This field increases so long as field 9 is nonzero.
Consequently, I would expect that the tenth field would be the sum of the fourth and eight fields as I would expect the total IO time to be the sum of the time spent reading and the time spent writing. However, I've never noticed this to be the case, and what's more I've always observed the sum of the fourth and eighth fields to be greater than the tenth (for example, in the line above (780672196 + 3472000824 - 812190100 = 3440482920). I was wondering if anyone could explain why these numbers are different, it seems the tenth field is trying to capture something different from just the sum of the fourth and eighth fields.