public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Yu Kuai <yukuai1@huaweicloud.com>,
	linux-block@vger.kernel.org, "yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH 1/2] block: add blk_time_get_ns() helper
Date: Tue, 16 Jan 2024 07:41:28 -0700	[thread overview]
Message-ID: <4493b71b-4596-4117-950d-5fe8aa11975a@kernel.dk> (raw)
In-Reply-To: <a67e7a44-5ac4-b18d-b0c8-b0a4b42e1224@huaweicloud.com>

On 1/15/24 11:42 PM, Yu Kuai wrote:
> Hi,
> 
> ? 2024/01/16 5:53, Jens Axboe ??:
>>   @@ -2810,7 +2810,7 @@ static void ioc_rqos_done(struct rq_qos *rqos, struct request *rq)
>>           return;
>>       }
>>   -    on_q_ns = ktime_get_ns() - rq->alloc_time_ns;
>> +    on_q_ns = blk_time_get_ns() - rq->alloc_time_ns;
> 
> Just notice that this is from io completion path, and the same as
> blk_account_io_done(), where plug does not exist. Hence ktime_get_ns()
> will still be called multiple times after patch 2.
> 
> Do you think will this worth to be optimized? For example, add a new
> field in request so that each rq completion will only call
> ktime_get_ns() once. Furthermore, we can optimize io_tices precision
> from jiffies to ns.

Right, as mentioned this is just an issue side optimization, my intent
is/was to convert all callers of ktime_get_ns() to use the internal one.
The completion side will just not get any amortization of the frequency
of time calls for now, but then it's prepared for that later on. That,
to me, was nicer than doing selective conversions as then it's not clear
if the two time sources could be compared.

It isn't complete yet, I just did the main components.

Putting it in the request is one way, ideally we'd have completion
batching via struct io_comp_batch for the completion side. At least that
was my plan.

-- 
Jens Axboe


  reply	other threads:[~2024-01-16 14:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15 21:53 [PATCHSET RFC 0/2] Cache issue side time querying Jens Axboe
2024-01-15 21:53 ` [PATCH 1/2] block: add blk_time_get_ns() helper Jens Axboe
2024-01-16  6:42   ` Yu Kuai
2024-01-16 14:41     ` Jens Axboe [this message]
2024-01-15 21:53 ` [PATCH 2/2] block: cache current nsec time in struct blk_plug Jens Axboe
2024-01-16  9:51   ` Kanchan Joshi
2024-01-16 10:25     ` Johannes Thumshirn
2024-01-16 10:47       ` Kanchan Joshi
2024-01-16 14:43     ` Jens Axboe
2024-01-16 16:13   ` Keith Busch
2024-01-16 16:18     ` 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=4493b71b-4596-4117-950d-5fe8aa11975a@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=yukuai1@huaweicloud.com \
    --cc=yukuai3@huawei.com \
    /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