Re: CFQ read performance regression

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Vivek Goyal
Date: Wednesday, April 28, 2010 - 1:02 pm

On Tue, Apr 27, 2010 at 07:25:14PM +0200, Corrado Zoccolo wrote:

Ok, I made some changes and now some queue merging seems to be happening
and I am getting little better BW. This will require more debugging. I
will try to spare some time later.

Kernel=2.6.34-rc5-corrado-multicfq
DIR= /mnt/iostmnt/fio          DEV= /dev/mapper/mpathe       
Workload=bsr       iosched=cfq      Filesz=1G    bs=16K  
==========================================================================
job       Set NR  ReadBW(KB/s)   MaxClat(us)    WriteBW(KB/s)  MaxClat(us)    
---       --- --  ------------   -----------    -------------  -----------    
bsr       1   1   136457         67353          0              0              
bsr       1   2   148008         192415         0              0              
bsr       1   4   180223         535205         0              0              
bsr       1   8   166983         542326         0              0              
bsr       1   16  176617         832188         0              0              

Output of iosched/bandwidth

0	546	740

I did following changes on top of your patch.

Vivek

---
 block/cfq-iosched.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 4e9e015..7589c44 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -243,6 +243,7 @@ struct cfq_data {
 	 */
 	int hw_tag_est_depth;
 	unsigned int hw_tag_samples;
+	unsigned int cfqq_merged_samples;
 	/*
 	 * performance measurements
 	 * max_bw is indexed by coop flag.
@@ -1736,10 +1737,14 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
 	// Opportunistic queue merging could be beneficial even on far queues
 	// We enable it only on NCQ disks, if we observed that merged queues
 	// can reach higher bandwidth than single queues.
+	// 204 sectors per jiffy is equivalent to 100MB/s on 1000 HZ conf.
+	// Allow merge if we don't have sufficient merged cfqq samples.
 	rs = cur_cfqq->allocated[READ] + cur_cfqq->allocated[WRITE];
-	if (cfqd->hw_tag && cfqd->max_bw[1] > cfqd->max_bw[0] &&
+	if (cfqd->hw_tag
+	   && (cfqd->max_bw[1] > cfqd->max_bw[0]
+	       || (cfqd->max_bw[0] > 204 && !sample_valid(cfqd->cfqq_merged_samples)))
 	    // Do not overload the device queue
-	    rs < cfqd->hw_tag_est_depth / 2) {
+	    && rs < cfqd->hw_tag_est_depth / 2) {
 		unsigned r1 = __cfqq->allocated[READ] + __cfqq->allocated[WRITE];
 		unsigned r2 = __cfqq1->allocated[READ] + __cfqq1->allocated[WRITE];
 		// Prefer merging with a queue that has fewer pending requests
@@ -1750,6 +1755,8 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
 		// Do not merge if the merged queue would have too many requests
 		if (r1 + rs > cfqd->hw_tag_est_depth / 2)
 			return NULL;
+		cfqd->cfqq_merged_samples++;
+
 		// Merge only if the BW of the two queues is comparable
 		if (abs(__cfqq->last_bw - cur_cfqq->last_bw) * 4 < cfqd->max_bw[0])
 			return __cfqq;
-- 
1.6.2.5

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
CFQ read performance regression, Miklos Szeredi, (Fri Apr 16, 5:27 am)
Re: CFQ read performance regression, Chris, (Fri Apr 16, 10:06 am)
Re: CFQ read performance regression, Corrado Zoccolo, (Sat Apr 17, 5:46 am)
Re: CFQ read performance regression, Miklos Szeredi, (Mon Apr 19, 4:46 am)
Re: CFQ read performance regression, Corrado Zoccolo, (Tue Apr 20, 1:50 pm)
Re: CFQ read performance regression, Miklos Szeredi, (Wed Apr 21, 6:25 am)
Re: CFQ read performance regression, Miklos Szeredi, (Wed Apr 21, 9:05 am)
Re: CFQ read performance regression, Corrado Zoccolo, (Thu Apr 22, 12:59 am)
Re: CFQ read performance regression, Miklos Szeredi, (Thu Apr 22, 3:23 am)
Re: CFQ read performance regression, Jan Kara, (Thu Apr 22, 8:53 am)
Re: CFQ read performance regression, Vivek Goyal, (Thu Apr 22, 1:31 pm)
Re: CFQ read performance regression, Miklos Szeredi, (Fri Apr 23, 3:48 am)
Re: CFQ read performance regression, Miklos Szeredi, (Fri Apr 23, 3:57 am)
Re: CFQ read performance regression, Corrado Zoccolo, (Sat Apr 24, 1:36 pm)
Re: CFQ read performance regression, Vivek Goyal, (Mon Apr 26, 6:50 am)
Re: CFQ read performance regression, Vivek Goyal, (Mon Apr 26, 12:14 pm)
Re: CFQ read performance regression, Corrado Zoccolo, (Tue Apr 27, 10:25 am)
Re: CFQ read performance regression, Vivek Goyal, (Wed Apr 28, 1:02 pm)
Re: CFQ read performance regression, Corrado Zoccolo, (Sat May 1, 5:13 am)
Re: CFQ read performance regression, Miklos Szeredi, (Mon Jun 14, 10:59 am)
Re: CFQ read performance regression, Vivek Goyal, (Mon Jun 14, 11:06 am)