On 3/9/20 4:59 PM, Jes Sorensen wrote: > From: Jes Sorensen <jsorensen@xxxxxx> > > Hi, > > This patchset introduces statistics collection of request sizes and > latencies for blk-mq using the blk-stat infrastructue. Hi, Any comments on this? Thanks, Jes > 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(-) >