public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Corrado Zoccolo <czoccolo@gmail.com>
To: "Linux-Kernel" <linux-kernel@vger.kernel.org>,
	Jens Axboe <jens.axboe@oracle.com>,
	Jeff Moyer <jmoyer@redhat.com>, Vivek Goyal <vgoyal@redhat.com>,
	mel@csn.ul.ie, efault@gmx.de
Subject: [RFC,PATCH] cfq-iosched: improve async queue ramp up formula
Date: Thu, 26 Nov 2009 17:10:39 +0100	[thread overview]
Message-ID: <200911261710.40719.czoccolo@gmail.com> (raw)

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



             reply	other threads:[~2009-11-26 16:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-26 16:10 Corrado Zoccolo [this message]
2009-11-26 21:25 ` [RFC,PATCH] cfq-iosched: improve async queue ramp up formula 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200911261710.40719.czoccolo@gmail.com \
    --to=czoccolo@gmail.com \
    --cc=efault@gmx.de \
    --cc=jens.axboe@oracle.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mel@csn.ul.ie \
    --cc=vgoyal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox