Thread (4 messages) 4 messages, 2 authors, 2018-11-30

Re: [PATCH] blk-mq: don't call ktime_get_ns() if we don't need it

From: Jens Axboe <axboe@kernel.dk>
Date: 2018-11-30 20:54:18

On 11/30/18 10:29 AM, Jens Axboe wrote:
On 11/30/18 10:27 AM, Christoph Hellwig wrote:
quoted
On Fri, Nov 30, 2018 at 08:56:25AM -0700, Jens Axboe wrote:
quoted
We only need the request fields and the end_io time if we have stats
enabled, or if we have a scheduler attached as those may use it for
completion time stats.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 block/blk-mq.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 7dcef565dc0f..2b458e9da946 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -316,7 +316,8 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
 	RB_CLEAR_NODE(&rq->rb_node);
 	rq->rq_disk = NULL;
 	rq->part = NULL;
-	rq->start_time_ns = ktime_get_ns();
+	if (data->q->elevator)
+		rq->start_time_ns = ktime_get_ns();
We also seem to use start_time_ns it in blk_account_io_done.
But only if RQF_STATS is set, in which case we are passing it in correctly.
Oh, needs a stats check for this one, for some reason I was thinking
of the end_io path. Will update.

-- 
Jens Axboe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help