diff options
author | Konstantin Khlebnikov <khlebnikov@yandex-team.ru> | 2020-03-25 14:07:06 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-03-25 15:49:10 +0100 |
commit | ea18e0f0a63af9064db3d4065d90fa743ae0991b (patch) | |
tree | 8956dcaaaebdac9d91317af6b5d53276c92bbeb0 /block/bio.c | |
parent | block/diskstats: more accurate approximation of io_ticks for slow disks (diff) | |
download | linux-ea18e0f0a63af9064db3d4065d90fa743ae0991b.tar.xz linux-ea18e0f0a63af9064db3d4065d90fa743ae0991b.zip |
block/diskstats: accumulate all per-cpu counters in one pass
Reading /proc/diskstats iterates over all cpus for summing each field.
It's faster to sum all fields in one pass.
Hammering /proc/diskstats with fio shows 2x performance improvement:
fio --name=test --numjobs=$JOBS --filename=/proc/diskstats \
--size=1k --bs=1k --fallocate=none --create_on_open=1 \
--time_based=1 --runtime=10 --invalidate=0 --group_report
JOBS=1 JOBS=10
Before: 7k iops 64k iops
After: 18k iops 120k iops
Also this way code is more compact:
add/remove: 1/0 grow/shrink: 0/2 up/down: 194/-1540 (-1346)
Function old new delta
part_stat_read_all - 194 +194
diskstats_show 1344 631 -713
part_stat_show 1219 392 -827
Total: Before=14966947, After=14965601, chg -0.01%
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/bio.c')
0 files changed, 0 insertions, 0 deletions