From: Ming Lei <ming.lei@redhat.com>
To: Yufen Yu <yuyufen@huawei.com>
Cc: axboe@kernel.dk, linux-block@vger.kernel.org,
josef@toxicpanda.com, hch@lst.de, bvanassche@acm.org
Subject: Re: [RFC PATCH 2/2] blk-mq: blk_mq_tag_to_rq() always return null for sched_tags
Date: Mon, 1 Mar 2021 14:50:19 +0800 [thread overview]
Message-ID: <YDyOq0eVr35h0GNK@T590> (raw)
In-Reply-To: <20210301021444.4134047-3-yuyufen@huawei.com>
On Sun, Feb 28, 2021 at 09:14:44PM -0500, Yufen Yu wrote:
> We just set hctx->tags->rqs[tag] when get driver tag, but will
> not set hctx->sched_tags->rqs[tag] when get sched tag.
> So, blk_mq_tag_to_rq() always return NULL for sched_tags.
True, also blk_mq_tag_to_rq() seems an awkward API, and it needs
'struct blk_mq_tags *', but which is a block layer internal definition.
>
> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
> ---
> block/blk-mq.c | 14 +++-----------
> 1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 5362a7958b74..424afe112b58 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -846,6 +846,7 @@ static int blk_mq_test_tag_bit(struct blk_mq_tags *tags, unsigned int tag)
>
> struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag)
> {
> + /* if tags is hctx->sched_tags, it always return NULL */
> if (tag < tags->nr_tags && blk_mq_test_tag_bit(tags, tag)) {
> prefetch(tags->rqs[tag]);
> return tags->rqs[tag];
> @@ -3845,17 +3846,8 @@ static bool blk_mq_poll_hybrid(struct request_queue *q,
>
> if (!blk_qc_t_is_internal(cookie))
> rq = blk_mq_tag_to_rq(hctx->tags, blk_qc_t_to_tag(cookie));
> - else {
> - rq = blk_mq_tag_to_rq(hctx->sched_tags, blk_qc_t_to_tag(cookie));
> - /*
> - * With scheduling, if the request has completed, we'll
> - * get a NULL return here, as we clear the sched tag when
> - * that happens. The request still remains valid, like always,
> - * so we should be safe with just the NULL check.
> - */
> - if (!rq)
> - return false;
> - }
> + else
> + return false;
>
I think the correct fix is to retrieve the request via:
hctx->sched_tags->static_rqs[blk_qc_t_to_tag(cookie)]
since it is nice to run blk_mq_poll_hybrid_sleep() for one
non-started request in case of real scheduler.
--
Ming
next prev parent reply other threads:[~2021-03-01 6:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-01 2:14 [RFC PATCH 0/2] blk-mq: improve blk_mq_tag_to_rq() Yufen Yu
2021-03-01 2:14 ` [RFC PATCH 1/2] blk-mq: test tags bitmap before get request Yufen Yu
2021-03-01 2:49 ` Damien Le Moal
2021-03-01 3:49 ` Bart Van Assche
2021-03-01 7:54 ` Hannes Reinecke
2021-03-01 12:20 ` John Garry
2021-03-01 2:14 ` [RFC PATCH 2/2] blk-mq: blk_mq_tag_to_rq() always return null for sched_tags Yufen Yu
2021-03-01 2:48 ` Damien Le Moal
2021-03-01 6:50 ` Ming Lei [this message]
2021-03-01 7:33 ` Yufen Yu
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=YDyOq0eVr35h0GNK@T590 \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=hch@lst.de \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=yuyufen@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