From: Chengming Zhou <chengming.zhou@linux.dev>
To: Tejun Heo <tj@kernel.org>
Cc: axboe@kernel.dk, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, zhouchengming@bytedance.com
Subject: Re: [PATCH v2 3/3] blk-mq: fix start_time_ns and alloc_time_ns for pre-allocated rq
Date: Tue, 27 Jun 2023 19:32:42 +0800 [thread overview]
Message-ID: <e1da325b-8f16-f4d2-d6bf-65976a4239b4@linux.dev> (raw)
In-Reply-To: <ZJn5F4xb6gln0653@slm.duckdns.org>
On 2023/6/27 04:46, Tejun Heo wrote:
> Hello,
>
> I only glanced the blk-mq core part but in general this looks a lot better
> than the previous one.
Thanks for your review!
>
> On Mon, Jun 26, 2023 at 01:04:05PM +0800, chengming.zhou@linux.dev wrote:
>> Note we don't skip setting alloc_time_ns and start_time_ns for all
>> pre-allocated rq, since the first returned rq still need to be set.
>
> This part is a bit curious for me tho. Why do we need to set it at batch
> allocation time and then at actual dispensing from the bat later? Who uses
> the alloc time stamp inbetween?
>
Yes, this part should need more explanation, and my explanation is not clear.
Now the batched pre-allocation code looks like this:
```
if (!rq_list_empty(plug->cached_rq))
get pre-allocated rq from plug cache
// we set alloc and start time here
return rq
else
rq = __blk_mq_alloc_requests_batch() do batched allocation (1)
(2)
return rq
```
In (1) we alloc some requests and push them in plug list, and pop one request
to return to use. So this popped one request need to be set time at batch allocation time.
Yes, we can also set this popped request time in (2), just before return it to use.
Since all requests in batch allocation use the same alloc and start time, so this patch
just leave it as it is, and reset it at actual used time.
I think both way is ok, do you think it's better to just set the popped one request, leave
other requests time to 0 ? If so, I can update to do it.
Thanks.
next prev parent reply other threads:[~2023-06-27 11:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-26 5:04 [PATCH v2 0/3] blk-mq: fix start_time_ns and alloc_time_ns for pre-allocated rq chengming.zhou
2023-06-26 5:04 ` [PATCH v2 1/3] blk-mq: always use __blk_mq_alloc_requests() to alloc and init rq chengming.zhou
2023-06-26 5:04 ` [PATCH v2 2/3] blk-mq: ktime_get_ns() only once for batched requests init chengming.zhou
2023-06-26 5:04 ` [PATCH v2 3/3] blk-mq: fix start_time_ns and alloc_time_ns for pre-allocated rq chengming.zhou
2023-06-26 20:46 ` Tejun Heo
2023-06-27 11:32 ` Chengming Zhou [this message]
2023-06-27 18:47 ` Tejun Heo
2023-06-28 1:16 ` Chengming Zhou
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=e1da325b-8f16-f4d2-d6bf-65976a4239b4@linux.dev \
--to=chengming.zhou@linux.dev \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=zhouchengming@bytedance.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