Skip to contentSkip to conversation

cfq-iosched: improve hw_tag detection

RFC In review Shaohua Li 2 participants 4 messages Oct 26, 2009 – Oct 27, 2009 Block layer

lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

RFC 1/1 cfq-iosched: improve hw_tag detection

If active queue hasn't enough requests and idle window opens, cfq will not dispatch sufficient requests to hardware. In such situation, current code will zero hw_tag. But this is because cfq doesn't dispatch enough requests instead of hardware queue doesn't work. Don't zero hw_tag in such case.

block/cfq-iosched.c +12 -0
index 069a610..0467049 100644
@@ -2166,6 +2166,8 @@ static void cfq_insert_request(struct request_queue *q, struct request *rq)
  */
 static void cfq_update_hw_tag(struct cfq_data *cfqd)
 {
+	struct cfq_queue *cfqq = cfqd->active_queue;
+
 	if (rq_in_driver(cfqd) > cfqd->rq_in_driver_peak)
 		cfqd->rq_in_driver_peak = rq_in_driver(cfqd);
 
@@ -2173,6 +2175,16 @@ static void cfq_update_hw_tag(struct cfq_data *cfqd)
 	    rq_in_driver(cfqd) <= CFQ_HW_QUEUE_MIN)
 		return;
 
+	/*
+	 * If active queue hasn't enough requests and can idle, cfq might not
+	 * dispatch sufficient requests to hardware. Don't zero hw_tag in this
+	 * case
+	 */
+	if (cfqq && cfq_cfqq_idle_window(cfqq) &&
+	    cfqq->dispatched + cfqq->queued[0] + cfqq->queued[1] <
+	    CFQ_HW_QUEUE_MIN && rq_in_driver(cfqd) < CFQ_HW_QUEUE_MIN)
+		return;
+
 	if (cfqd->hw_tag_samples++ < 50)
 		return;
 
#1 lore raw
Quoted 4 lines · Shaohua Li

If active queue hasn't enough requests and idle window opens, cfq will not dispatch sufficient requests to hardware. In such situation, current code will zero hw_tag. But this is because cfq doesn't dispatch enough requests instead of hardware queue doesn't work. Don't zero hw_tag in such case.

Thanks, that looks like a good fix. Curious, is this fixing some regression at your end?

Signature · 1 line
Jens Axboe
author
#2 lore raw
Quoted 8 lines · Jens Axboe
Quoted 4 lines · Shaohua Li

If active queue hasn't enough requests and idle window opens, cfq will not dispatch sufficient requests to hardware. In such situation, current code will zero hw_tag. But this is because cfq doesn't dispatch enough requests instead of hardware queue doesn't work. Don't zero hw_tag in such case.

Thanks, that looks like a good fix. Curious, is this fixing some regression at your end?

No, just observed such issue when I play with cfq.

Thanks,
Shaohua

#3 lore raw
Quoted 10 lines · Shaohua Li
Quoted 8 lines · Jens Axboe
Quoted 4 lines · Shaohua Li

If active queue hasn't enough requests and idle window opens, cfq will not dispatch sufficient requests to hardware. In such situation, current code will zero hw_tag. But this is because cfq doesn't dispatch enough requests instead of hardware queue doesn't work. Don't zero hw_tag in such case.

Thanks, that looks like a good fix. Curious, is this fixing some regression at your end?

No, just observed such issue when I play with cfq.

OK thanks, just curious. I will apply it for 2.6.33.

Signature · 1 line
Jens Axboe