public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC,PATCH] cfq-iosched: improve async queue ramp up formula
@ 2009-11-26 16:10 Corrado Zoccolo
  2009-11-26 21:25 ` Mel Gorman
  2009-11-27  8:23 ` Jens Axboe
  0 siblings, 2 replies; 9+ messages in thread
From: Corrado Zoccolo @ 2009-11-26 16:10 UTC (permalink / raw)
  To: Linux-Kernel, Jens Axboe, Jeff Moyer, Vivek Goyal, mel, efault

The introduction of ramp-up formula for async queue depths has
slowed down dirty page reclaim, by reducing async write performance.
This patch improves the formula by considering the remaining slice.

The new formula will allow more dispatches at the beginning of the
slice, reducing them at the end.
This will ensure that we achieve good throughput, without the risk of
overrunning the allotted timeslice.

The threshold is automatically increased when sync I/O is not
intermingled with async, in accordance with the previous incarnation of
the formula.

Signed-off-by: Corrado Zoccolo <czoccolo@gmail.com>
---
 block/cfq-iosched.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index a5de31f..799782d 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1633,12 +1633,24 @@ static bool cfq_may_dispatch(struct cfq_data *cfqd, struct cfq_queue *cfqq)
 	 * based on the last sync IO we serviced
 	 */
 	if (!cfq_cfqq_sync(cfqq) && cfqd->cfq_latency) {
-		unsigned long last_sync = jiffies - cfqd->last_end_sync_rq;
-		unsigned int depth;
-
-		depth = last_sync / cfqd->cfq_slice[1];
-		if (!depth && !cfqq->dispatched)
-			depth = 1;
+		unsigned long now = jiffies;
+		unsigned long last_sync = now - cfqd->last_end_sync_rq;
+		unsigned int depth = 1;
+		if (cfqq->slice_end > now) {
+			unsigned int num,den;
+			/*
+			 * (cfqq->slice_end - now) / cfqd->cfq_slice_idle
+			 * approximates the number of requests that can be
+			 * dispatched before our slice ends
+			 * last_sync/cfq_slice[1] gives a boost when no
+			 * concurrent sync activity is expected
+			 */
+			num = last_sync          * (cfqq->slice_end - now);
+			den = cfqd->cfq_slice[1] * cfqd->cfq_slice_idle;
+			if (!den)
+				den++;
+			depth += num / den;
+		}
 		if (depth < max_dispatch)
 			max_dispatch = depth;
 	}
-- 
1.6.2.5



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

end of thread, other threads:[~2009-11-30 18:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-26 16:10 [RFC,PATCH] cfq-iosched: improve async queue ramp up formula Corrado Zoccolo
2009-11-26 21:25 ` Mel Gorman
2009-11-27  8:23 ` Jens Axboe
2009-11-27  9:03   ` Corrado Zoccolo
2009-11-27 11:48     ` Jens Axboe
2009-11-27 15:12       ` Corrado Zoccolo
2009-11-27 16:05       ` Mel Gorman
2009-11-30 17:06     ` Vivek Goyal
2009-11-30 18:58       ` Corrado Zoccolo

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