linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [PATCH] blk-mq: don't call ktime_get_ns() if we don't need it
Date: Fri, 30 Nov 2018 09:27:04 -0800	[thread overview]
Message-ID: <20181130172704.GA16952@infradead.org> (raw)
In-Reply-To: <51a1cb7b-6136-a220-6cac-9bccd2262ca3@kernel.dk>

On Fri, Nov 30, 2018 at 08:56:25AM -0700, Jens Axboe wrote:
> 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.

Also update it in attempt_merge, which might have some odd results
for completly uninitialized fields.

  reply	other threads:[~2018-11-30 17:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-30 15:56 [PATCH] blk-mq: don't call ktime_get_ns() if we don't need it Jens Axboe
2018-11-30 17:27 ` Christoph Hellwig [this message]
2018-11-30 17:29   ` Jens Axboe
2018-11-30 20:54     ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181130172704.GA16952@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).