diff options
author | Bart Van Assche <bvanassche@acm.org> | 2024-12-18 13:22:45 -0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2025-01-14 10:13:25 -0700 |
commit | 44e41381591dc5b4ea67a9f170b4ec85c817586e (patch) | |
tree | 66bf9f485c1eb1ae482d7069d8042aa33cd6030b /block | |
parent | e7b94c5c6f3b6435206f0e4ef7c5aa4eceae42f9 (diff) |
block: Reorder the request allocation code in blk_mq_submit_bio()
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>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-mq.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 655dcc16db76..b815ac4872b7 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -3125,12 +3125,12 @@ void blk_mq_submit_bio(struct bio *bio) goto queue_exit; 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); |