From: Simon Liebold <simonlie@amazon.de>
To: <linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Cc: Bart Van Assche <bvanassche@acm.org>,
Damien Le Moal <dlemoal@kernel.org>,
Christoph Hellwig <hch@lst.de>,
Chaitanya Kulkarni <kch@nvidia.com>,
"Jens Axboe" <axboe@kernel.dk>,
Simon Liebold <simonlie@amazon.de>
Subject: [PATCH 6.12.y 1/3] block: Reorder the request allocation code in blk_mq_submit_bio()
Date: Wed, 12 Aug 2026 13:54:10 +0000 [thread overview]
Message-ID: <20260812135412.2715611-1-simonlie@amazon.de> (raw)
From: Bart Van Assche <bvanassche@acm.org>
[ Upstream commit 44e41381591dc5b4ea67a9f170b4ec85c817586e ]
Help the CPU branch predictor in case of a cache hit by handling the cache
hit scenario first.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Link: https://lore.kernel.org/r/20241218212246.1073149-2-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Stable-dep-of: dc278e9bf2b9 ("blk-mq: pop cached request if it is usable")
Signed-off-by: Simon Liebold <simonlie@amazon.de>
---
block/blk-mq.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 5bfaa8e4b9cf6..c1dff0d9f9439 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3121,12 +3121,12 @@ void blk_mq_submit_bio(struct bio *bio)
}
new_request:
- if (!rq) {
+ if (rq) {
+ blk_mq_use_cached_rq(rq, plug, bio);
+ } else {
rq = blk_mq_get_new_requests(q, plug, bio, nr_segs);
if (unlikely(!rq))
goto queue_exit;
- } else {
- blk_mq_use_cached_rq(rq, plug, bio);
}
trace_block_getrq(bio);
base-commit: 25c09b42358e73e1476e517b296edb6344f2e4bd
--
2.50.1
next reply other threads:[~2026-08-12 13:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 13:54 Simon Liebold [this message]
2026-08-12 13:54 ` [PATCH 6.12.y 2/3] blk-mq: pop cached request if it is usable Simon Liebold
2026-08-12 13:54 ` [PATCH 6.12.y 3/3] blk-mq: reinsert cached request to the list Simon Liebold
2026-08-15 2:33 ` [PATCH 6.12.y 1/3] block: Reorder the request allocation code in blk_mq_submit_bio() Sasha Levin
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=20260812135412.2715611-1-simonlie@amazon.de \
--to=simonlie@amazon.de \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=dlemoal@kernel.org \
--cc=hch@lst.de \
--cc=kch@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@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
all inboxes | Powered by JetHome®