public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC]cfq-iosched: improve hw_tag detection
@ 2009-10-26  9:16 Shaohua Li
  2009-10-26 11:35 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Shaohua Li @ 2009-10-26  9:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: jens.axboe

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.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 069a610..0467049 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -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;
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC]cfq-iosched: improve hw_tag detection
  2009-10-26  9:16 [RFC]cfq-iosched: improve hw_tag detection Shaohua Li
@ 2009-10-26 11:35 ` Jens Axboe
  2009-10-27  0:50   ` Shaohua Li
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2009-10-26 11:35 UTC (permalink / raw)
  To: Shaohua Li; +Cc: linux-kernel

On Mon, Oct 26 2009, Shaohua Li wrote:
> 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?

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC]cfq-iosched: improve hw_tag detection
  2009-10-26 11:35 ` Jens Axboe
@ 2009-10-27  0:50   ` Shaohua Li
  2009-10-27  7:45     ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Shaohua Li @ 2009-10-27  0:50 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel@vger.kernel.org

On Mon, Oct 26, 2009 at 07:35:55PM +0800, Jens Axboe wrote:
> On Mon, Oct 26 2009, Shaohua Li wrote:
> > 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC]cfq-iosched: improve hw_tag detection
  2009-10-27  0:50   ` Shaohua Li
@ 2009-10-27  7:45     ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2009-10-27  7:45 UTC (permalink / raw)
  To: Shaohua Li; +Cc: linux-kernel@vger.kernel.org

On Tue, Oct 27 2009, Shaohua Li wrote:
> On Mon, Oct 26, 2009 at 07:35:55PM +0800, Jens Axboe wrote:
> > On Mon, Oct 26 2009, Shaohua Li wrote:
> > > 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.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-10-27  7:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-26  9:16 [RFC]cfq-iosched: improve hw_tag detection Shaohua Li
2009-10-26 11:35 ` Jens Axboe
2009-10-27  0:50   ` Shaohua Li
2009-10-27  7:45     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox