Skip to content

blk-mq request and latency stats

Jes Sorensen linux-block 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7block: keep track of per-device io sizes in statsblock/blk-iolatency.c block/blk-stat.c block/blk-stat.h +1 more+11 -80 replies
2/7block: Use blk-stat infrastructure to collect per queue request statsblock/blk-mq.c block/blk-stat.h block/blk-sysfs.c +1 more+100 -00 replies
3/7Export block request stats to sysfsblock/blk-sysfs.c+23 -00 replies
4/7Expand block stats to export number of of requests per bucketblock/blk-sysfs.c+8 -00 replies
5/7blk-mq: Only allocate request stat data when it is enabledblock/blk-mq.c block/blk-stat.h block/blk-sysfs.c +1 more+45 -150 replies
6/7blk-stat: Make bucket function take latency as an additional argumentblock/blk-mq.c block/blk-stat.c block/blk-stat.h +1 more+9 -90 replies
7/7block: Introduce blk-mq latency statsblock/blk-mq.c block/blk-stat.h block/blk-sysfs.c +1 more+159 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/7] blk-mq request and latency stats

From: Jes Sorensen <[email protected]>

Hi,

This patchset introduces statistics collection of request sizes and latencies for blk-mq using the blk-stat infrastructue.

This was designed to have minimal overhead when not in use. It relies on blk_rq_stats_sectors() and introduces a sectors counter to struct blk_rq_stat.

For request sizes it uses 8 buckets per operation type. Latencies are tracked in us precision, and uses 32 buckets per operation type. To not blow up the size of struct request_queue, I changed it to dynamically allocate these data structures.

Usage, request stats are enabled like this:

 $ echo 1 > /sys/block/nvme0n1/queue/reqstat
with output reading like this:
 $ cat /sys/block/nvme0n1/queue/stat
 read: 0 0 0 8278016 14270464 29323264 120107008 2069282816
 read reqs: 0 0 0 2021 1531 1377 3229 3627
 write: 4096 0 3072 10903552 9244672 6258688 16584704 2228011008
 write reqs: 8 0 1 2662 898 311 375 4972
 discard: 0 0 0 5242880 5472256 3809280 136880128 830554112
 discard reqs: 0 0 0 1280 515 196 4150 3717

Latency stats are enabled like this:

 $ echo 1 > /sys/block/nvme0n1/queue/latstat
with output reading like this
 $  cat /sys/block/nvme0n1/queue/latency
 read: 0 0 0 0 4 101 677 5146 1162 2654 1933 832 657 52 8 0 3 2 3 2 0 0 0 0 0 0 0 0 0 0 0 0
 write: 0 0 0 79 2564 2641 8087 6226 1580 4052 498 332 385 365 382 279 323 166 109 119 188 267 0 0 0 0 0 0 0 0 0 0
 discard: 0 0 0 0 0 0 0 17709 698 15 0 1 0 0 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Cheers,
Jes

Jes Sorensen (7):
block: keep track of per-device io sizes in stats
block: Use blk-stat infrastructure to collect per queue request stats Export block request stats to sysfs
Expand block stats to export number of of requests per bucket
blk-mq: Only allocate request stat data when it is enabled
blk-stat: Make bucket function take latency as an additional argument
block: Introduce blk-mq latency stats

 block/blk-iolatency.c     |   2 +-
 block/blk-mq.c            | 110 ++++++++++++++++++++-
 block/blk-stat.c          |  18 ++--
 block/blk-stat.h          |  12 ++-
 block/blk-sysfs.c         | 195 ++++++++++++++++++++++++++++++++++++++
 block/blk-wbt.c           |   2 +-
 include/linux/blk_types.h |   1 +
 include/linux/blkdev.h    |  13 +++
 8 files changed, 338 insertions(+), 15 deletions(-)
Signature · 1 line
2.17.1