Skip to contentSkip to conversation

block: Requeue req as head if driver touched it

PATCH In review Christian Löhle 2 participants 3 messages Oct 26, 2022 – Jan 18, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 block: Requeue req as head if driver touched it

In case the driver set RQF_DONTPREP flag, requeue the request as head as it is likely that the backing storage already had a request to an adjacent region, so getting the requeued request out as soon as possible may give us some performance benefit.

---
 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +1 -1
index 33292c01875d..d863c826fb23 100644
@@ -1429,7 +1429,7 @@ static void blk_mq_requeue_work(struct work_struct *work)
 		 * merge.
 		 */
 		if (rq->rq_flags & RQF_DONTPREP)
-			blk_mq_request_bypass_insert(rq, false, false);
+			blk_mq_request_bypass_insert(rq, true, false);
 		else
 			blk_mq_sched_insert_request(rq, true, false, false);
 	}
Signature · 4 lines
2.37.3
Hyperstone GmbH | Reichenaustr. 39a  | 78467 Konstanz
Managing Director: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782
Reviewed-by on v1 1/3
#1 lore raw
Quoted 5 lines · Christian Löhle

In case the driver set RQF_DONTPREP flag, requeue the request as head as it is likely that the backing storage already had a request to an adjacent region, so getting the requeued request out as soon as possible may give us some performance benefit.

This is a bit handwavy to me. Would you mind extending this with a small concrete example, to better understand the benefit?

Quoted 2 lines

Other than the above nitpick, I can't think of any obvious unwanted side-effects this could have. So, feel free to add:

Kind regards
Uffe

Quoted 23 lines
---
 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +1 -2
index 33292c01875d..d863c826fb23 100644
@@ -1429,7 +1429,7 @@ static void blk_mq_requeue_work(struct work_struct *work)
                 * merge.
                 */
                if (rq->rq_flags & RQF_DONTPREP)
-                       blk_mq_request_bypass_insert(rq, false, false);
+                       blk_mq_request_bypass_insert(rq, true, false);
                else
                        blk_mq_sched_insert_request(rq, true, false, false);
        }
--

2.37.3
Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz Managing Director: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782

#2 lore raw
In reply to Christian Löhle

Jens could you consider this patch?
As far as I can see Barts series has not been merged in any form that would fix my problem and even if it does, requeuing RQF_DONTPREP as head seems on par at worst and a performance improvement at best.

-----Original Message-----
From: Christian Löhle
Sent: Mittwoch, 26. Oktober 2022 09:29
To: [email protected]; [email protected]; [email protected]; [email protected]; '[email protected]' <[email protected]>
Cc: 'Avri Altman' <[email protected]>; [email protected]; [email protected]; 'Christian Löhle' <[email protected]>
Subject: [PATCH 1/3] block: Requeue req as head if driver touched it

In case the driver set RQF_DONTPREP flag, requeue the request as head as it is likely that the backing storage already had a request to an adjacent region, so getting the requeued request out as soon as possible may give us some performance benefit.

---
 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +1 -1
@@ -1429,7 +1429,7 @@ static void blk_mq_requeue_work(struct work_struct *work)
 		 * merge.
 		 */
 		if (rq->rq_flags & RQF_DONTPREP)
-			blk_mq_request_bypass_insert(rq, false, false);
+			blk_mq_request_bypass_insert(rq, true, false);
 		else
 			blk_mq_sched_insert_request(rq, true, false, false);
 	}

--
2.37.3

Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz Managing Director: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782