Skip to contentSkip to conversation

blk-mq: reinsert cached request to the list

PATCH Applied Keith Busch 4 participants 4 messages May 26 – May 27 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 blk-mq: reinsert cached request to the list

From: Keith Busch <[email protected]>

A previous commit removed an optimization out of caution for a scenario that turns out not to be real: all the "queue_exit" goto's are safe to reinsert the request into the cached_rq's plug list as they are either from a non-blocking path, or a successful merge that already holds the queue reference. This optimization is most needed for small sequential workloads that successfully merge into larger requests.

Fixes dc278e9bf2b9 ("blk-mq: pop cached request if it is usable")

---
v1->v2:

Actually use the correct rq_list function to return the rq to the list.

 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +1 -1
index 28c2d931e75ea..a24175441380e 100644
@@ -3246,7 +3246,7 @@ void blk_mq_submit_bio(struct bio *bio)
 	if (!rq)
 		blk_queue_exit(q);
 	else
-		blk_mq_free_request(rq);
+		rq_list_add_head(&plug->cached_rqs, rq);
 }
 
 #ifdef CONFIG_BLK_MQ_STACKING
Signature · 1 line
2.53.0-Meta
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Keith Busch

From: Keith Busch<[email protected]>

A previous commit removed an optimization out of caution for a scenario that turns out not to be real: all the "queue_exit" goto's are safe to reinsert the request into the cached_rq's plug list as they are either from a non-blocking path, or a successful merge that already holds the queue reference. This optimization is most needed for small sequential workloads that successfully merge into larger requests.

Quoted 4 lines
Fixes dc278e9bf2b9 ("blk-mq: pop cached request if it is usable")

Looks good.

-ck

maintainer Applied
#2 lore raw
In reply to Keith Busch
Quoted 8 lines · Keith Busch

A previous commit removed an optimization out of caution for a scenario that turns out not to be real: all the "queue_exit" goto's are safe to reinsert the request into the cached_rq's plug list as they are either from a non-blocking path, or a successful merge that already holds the queue reference. This optimization is most needed for small sequential workloads that successfully merge into larger requests.

[...]

Applied, thanks!

[1/1] blk-mq: reinsert cached request to the list

      commit: b051bb6bf0a231117036aa607cadf55be8e63910

Best regards,

Signature · 1 line
Jens Axboe
Reviewed-by on v2 1/1
#3 lore raw
In reply to Keith Busch
Quoted 28 lines · Keith Busch

From: Keith Busch <[email protected]>

A previous commit removed an optimization out of caution for a scenario that turns out not to be real: all the "queue_exit" goto's are safe to reinsert the request into the cached_rq's plug list as they are either from a non-blocking path, or a successful merge that already holds the queue reference. This optimization is most needed for small sequential workloads that successfully merge into larger requests.

Fixes dc278e9bf2b9 ("blk-mq: pop cached request if it is usable")

---
v1->v2:

Actually use the correct rq_list function to return the rq to the list.

 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +0 -0
index 28c2d931e75ea..a24175441380e 100644

block/blk-mq.c void blk_mq_submit_bio(struct bio *bio) · line 3250

Quoted 6 lines
block/blk-mq.c +1 -1
@@ -3246,7 +3246,7 @@ void blk_mq_submit_bio(struct bio *bio)
        if (!rq)
                blk_queue_exit(q);
        else
-               blk_mq_free_request(rq);
+               rq_list_add_head(&plug->cached_rqs, rq);
 }

Thanks,
Ming Lei