From: Christoph Hellwig <hch@infradead.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Subject: Re: [PATCH 2/4] block: inline fast path of driver tag allocation
Date: Wed, 13 Oct 2021 18:22:47 +0100 [thread overview]
Message-ID: <YWcV52525ZR6ilwx@infradead.org> (raw)
In-Reply-To: <20211013164937.985367-3-axboe@kernel.dk>
On Wed, Oct 13, 2021 at 10:49:35AM -0600, Jens Axboe wrote:
> If we don't use an IO scheduler or have shared tags, then we don't need
> to call into this external function at all. This saves ~2% for such
> a setup.
Hmm. What happens if you just throw an inline tag onto
blk_mq_get_driver_tag? All the high performance callers should be
in blk-mq.c anyway. If that isn't enough maybe something like the
version below?
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 38e6651d8b94c..ba9af26d5209d 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1126,18 +1126,23 @@ static bool __blk_mq_get_driver_tag(struct request *rq)
return true;
}
-bool blk_mq_get_driver_tag(struct request *rq)
+static void blk_mq_inc_active_requests(struct request *rq)
+{
+ if (!(rq->rq_flags & RQF_MQ_INFLIGHT)) {
+ rq->rq_flags |= RQF_MQ_INFLIGHT;
+ __blk_mq_inc_active_requests(rq->mq_hctx);
+ }
+}
+
+inline bool blk_mq_get_driver_tag(struct request *rq)
{
struct blk_mq_hw_ctx *hctx = rq->mq_hctx;
if (rq->tag == BLK_MQ_NO_TAG && !__blk_mq_get_driver_tag(rq))
return false;
- if ((hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED) &&
- !(rq->rq_flags & RQF_MQ_INFLIGHT)) {
- rq->rq_flags |= RQF_MQ_INFLIGHT;
- __blk_mq_inc_active_requests(hctx);
- }
+ if (hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED)
+ blk_mq_inc_active_requests(rq);
hctx->tags->rqs[rq->tag] = rq;
return true;
}
next prev parent reply other threads:[~2021-10-13 17:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-13 16:49 [PATCHSET 0/4] Various block optimizations Jens Axboe
2021-10-13 16:49 ` [PATCH 1/4] block: provide helpers for rq_list manipulation Jens Axboe
2021-10-13 17:11 ` Christoph Hellwig
2021-10-13 17:47 ` Jens Axboe
2021-10-13 16:49 ` [PATCH 2/4] block: inline fast path of driver tag allocation Jens Axboe
2021-10-13 17:22 ` Christoph Hellwig [this message]
2021-10-13 17:46 ` Jens Axboe
2021-10-13 17:57 ` Christoph Hellwig
2021-10-13 18:07 ` Jens Axboe
2021-10-13 16:49 ` [PATCH 3/4] block: don't bother iter advancing a fully done bio Jens Axboe
2021-10-13 17:26 ` Christoph Hellwig
2021-10-13 17:46 ` Jens Axboe
2021-10-13 16:49 ` [PATCH 4/4] block: move update request helpers into blk-mq.c Jens Axboe
2021-10-13 17:32 ` Christoph Hellwig
2021-10-13 17:46 ` Jens Axboe
2021-10-13 17:54 ` Christoph Hellwig
2021-10-13 17:57 ` Jens Axboe
2021-10-14 5:00 ` Christoph Hellwig
2021-10-14 15:14 ` 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=YWcV52525ZR6ilwx@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