From: Chengming Zhou <zhouchengming@bytedance.com>
To: Christoph Hellwig <hch@lst.de>, chengming.zhou@linux.dev
Cc: axboe@kernel.dk, tj@kernel.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, ming.lei@redhat.com
Subject: Re: [PATCH v3 1/3] blk-mq: always use __blk_mq_alloc_requests() to alloc and init rq
Date: Thu, 29 Jun 2023 15:40:03 +0800 [thread overview]
Message-ID: <f91c32b3-1d3b-b28c-40cb-2edf02448f22@bytedance.com> (raw)
In-Reply-To: <20230629052828.GD16819@lst.de>
On 2023/6/29 13:28, Christoph Hellwig wrote:
> On Wed, Jun 28, 2023 at 08:45:44PM +0800, chengming.zhou@linux.dev wrote:
>> After these cleanup, __blk_mq_alloc_requests() is the only entry to
>> alloc and init rq.
>
> I find the code a little hard to follow now, due to the optional
> setting of the ctx. We also introduce really odd behavior here
> if the caller for a hctx-specific allocation doesn't have free
> tags, as we'll now run into the normal retry path.
>
> Is this really needed for your timestamp changes? If not I'd prefer
> to skip it.
>
Thanks for your review!
Since hctx-specific allocation path always has BLK_MQ_REQ_NOWAIT flag,
it won't retry.
But I agree, this makes the general __blk_mq_alloc_requests() more complex.
The reason is blk_mq_rq_ctx_init() has some data->rq_flags initialization:
```
if (data->flags & BLK_MQ_REQ_PM)
data->rq_flags |= RQF_PM;
if (blk_queue_io_stat(q))
data->rq_flags |= RQF_IO_STAT;
rq->rq_flags = data->rq_flags;
```
Because we need this data->rq_flags to tell if we need start_time_ns,
we need to put these initialization in the callers of blk_mq_rq_ctx_init().
Now we basically have two callers, the 1st is general __blk_mq_alloc_requests(),
the 2nd is the special blk_mq_alloc_request_hctx(). So I change the 2nd caller
to reuse the 1st __blk_mq_alloc_requests().
Or we put these data->rq_flags initialization in blk_mq_alloc_request_hctx() too?
Thanks.
next prev parent reply other threads:[~2023-06-29 7:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 12:45 [PATCH v3 0/3] blk-mq: fix start_time_ns and alloc_time_ns for pre-allocated rq chengming.zhou
2023-06-28 12:45 ` [PATCH v3 1/3] blk-mq: always use __blk_mq_alloc_requests() to alloc and init rq chengming.zhou
2023-06-29 5:28 ` Christoph Hellwig
2023-06-29 7:40 ` Chengming Zhou [this message]
2023-07-10 7:36 ` Christoph Hellwig
2023-07-10 11:07 ` Chengming Zhou
2023-06-28 12:45 ` [PATCH v3 2/3] blk-mq: ktime_get_ns() only once for batched requests init chengming.zhou
2023-06-29 5:30 ` Christoph Hellwig
2023-06-29 6:44 ` Chengming Zhou
2023-06-28 12:45 ` [PATCH v3 3/3] blk-mq: fix start_time_ns and alloc_time_ns for pre-allocated rq chengming.zhou
[not found] ` <1bf88665-f779-7d45-1d5f-1af05aeb0882@web.de>
2023-06-29 4:58 ` Christoph Hellwig
2023-06-29 5:32 ` Christoph Hellwig
2023-06-29 6:42 ` 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=f91c32b3-1d3b-b28c-40cb-2edf02448f22@bytedance.com \
--to=zhouchengming@bytedance.com \
--cc=axboe@kernel.dk \
--cc=chengming.zhou@linux.dev \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=tj@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