blk-cgroup: Fix the recursive blkg rwstat
authorXunlei Pang <xlpang@linux.alibaba.com>
Fri, 5 Mar 2021 08:13:27 +0000 (16:13 +0800)
committerJens Axboe <axboe@kernel.dk>
Fri, 5 Mar 2021 18:32:15 +0000 (11:32 -0700)
commit4f44657d74873735e93a50eb25014721a66aac19
treef0a94ec0d1441a685809b819c1c889b2772434f8
parent66f669a272898feb1c69b770e1504aa2ec7723d1
blk-cgroup: Fix the recursive blkg rwstat

The current blkio.throttle.io_service_bytes_recursive doesn't
work correctly.

As an example, for the following blkcg hierarchy:
 (Made 1GB READ in test1, 512MB READ in test2)
     test
    /    \
 test1   test2

$ head -n 1 test/test1/blkio.throttle.io_service_bytes_recursive
8:0 Read 1073684480
$ head -n 1 test/test2/blkio.throttle.io_service_bytes_recursive
8:0 Read 537448448
$ head -n 1 test/blkio.throttle.io_service_bytes_recursive
8:0 Read 537448448

Clearly, above data of "test" reflects "test2" not "test1"+"test2".

Do the correct summary in blkg_rwstat_recursive_sum().

Signed-off-by: Xunlei Pang <xlpang@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-cgroup-rwstat.c