[PATCH v4 0/2] blk-mq: fix start_time_ns and alloc_time_ns for pre-allocated rq

From: chengming . zhou
Date: Thu Jun 29 2023 - 08:13:54 EST


From: Chengming Zhou <zhouchengming@xxxxxxxxxxxxx>

Hello,

This patchset fix start_time_ns and alloc_time_ns for pre-allocated rq.

patch 1 is preparation that we move data->rq_flags initialization code
outside blk_mq_rq_ctx_init() to its caller, since we will need it to
tell if we need to get start_time_ns.

patch 2 is the fix patch that we set alloc_time_ns and start_time_ns
to now when the pre-allocated rq is actually used and we skip setting
during pre-allocation.

v4:
- Combine the last two patches into one patch for clearer review.
- Use blk_mq_alloc_data to pass start_time_ns instead of passing down
yet another parameter. Thanks Christoph Hellwig.
- [v3] https://lore.kernel.org/all/20230628124546.1056698-1-chengming.zhou@xxxxxxxxx/

v3:
- Skip setting the alloc_time_ns and start_time_ns during pre-allocation,
which is clearer, as suggested by Tejun.
- [v2] https://lore.kernel.org/all/20230626050405.781253-1-chengming.zhou@xxxxxxxxx/

v2:
- Let blk_mq_rq_ctx_init() receive start_time_ns for batched time setting.
- Set alloc_time_ns and start_time_ns when the pre-allocated rq is actually
used, as suggested by Tejun.
- [v1] https://lore.kernel.org/all/20230601053919.3639954-1-chengming.zhou@xxxxxxxxx/

Chengming Zhou (2):
blk-mq: move data->rq_flags initialization code
blk-mq: fix start_time_ns and alloc_time_ns for pre-allocated rq

block/blk-mq.c | 87 ++++++++++++++++++++++++------------------
block/blk-mq.h | 1 +
include/linux/blk-mq.h | 6 +--
3 files changed, 53 insertions(+), 41 deletions(-)

--
2.39.2