From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>, asml.silence@gmail.com
Subject: [PATCH v2 3/3] blk-mq: optimise *end_request non-stat path
Date: Wed, 13 Oct 2021 09:57:13 +0100 [thread overview]
Message-ID: <e0f2ea812e93a8adcd07101212e7d7e70ca304e7.1634115360.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1634115360.git.asml.silence@gmail.com>
We already have a blk_mq_need_time_stamp() check in
__blk_mq_end_request() to get a timestamp, hide all the statistics
accounting under it. It cuts some cycles for requests that don't need
stats, and is free otherwise.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
block/blk-mq.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 38e6651d8b94..3dd3b22bc280 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -572,20 +572,18 @@ void blk_mq_free_plug_rqs(struct blk_plug *plug)
inline void __blk_mq_end_request(struct request *rq, blk_status_t error)
{
- u64 now = 0;
+ if (blk_mq_need_time_stamp(rq)) {
+ u64 now = ktime_get_ns();
- if (blk_mq_need_time_stamp(rq))
- now = ktime_get_ns();
+ if (rq->rq_flags & RQF_STATS) {
+ blk_mq_poll_stats_start(rq->q);
+ blk_stat_add(rq, now);
+ }
- if (rq->rq_flags & RQF_STATS) {
- blk_mq_poll_stats_start(rq->q);
- blk_stat_add(rq, now);
+ blk_mq_sched_completed_request(rq, now);
+ blk_account_io_done(rq, now);
}
- blk_mq_sched_completed_request(rq, now);
-
- blk_account_io_done(rq, now);
-
if (rq->end_io) {
rq_qos_done(rq->q, rq);
rq->end_io(rq, error);
--
2.33.0
next prev parent reply other threads:[~2021-10-13 8:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-13 8:57 [PATCH v2 0/3] on top of for-5.16/block Pavel Begunkov
2021-10-13 8:57 ` [PATCH v2 1/3] block: cache bdev in struct file for raw bdev IO Pavel Begunkov
2021-10-13 15:19 ` Christoph Hellwig
2021-10-13 8:57 ` [PATCH v2 2/3] block: don't hide inode from block_device users Pavel Begunkov
2021-10-13 14:03 ` kernel test robot
2021-10-13 15:03 ` kernel test robot
2021-10-13 15:12 ` Pavel Begunkov
2021-10-15 0:40 ` [kbuild-all] " Chen, Rong A
2021-10-13 15:25 ` Christoph Hellwig
2021-10-13 18:44 ` Pavel Begunkov
2021-10-14 4:51 ` Christoph Hellwig
2021-10-14 9:35 ` Pavel Begunkov
2021-10-13 8:57 ` Pavel Begunkov [this message]
2021-10-13 15:30 ` [PATCH v2 3/3] blk-mq: optimise *end_request non-stat path Christoph Hellwig
2021-10-13 9:15 ` [PATCH v2 0/3] on top of for-5.16/block Pavel Begunkov
2021-10-13 15:53 ` (subset) " 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=e0f2ea812e93a8adcd07101212e7d7e70ca304e7.1634115360.git.asml.silence@gmail.com \
--to=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@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
Powered by JetHome