Re: 2.6.20-rc2+: CFQ halving disk throughput.

Jens Axboe
2007-01-02T12:10:53Z

On Tue, Jan 02 2007, Jens Axboe wrote:
> On Tue, Jan 02 2007, Rene Herman wrote:
> > Jens Axboe wrote:
> >
> > >On Mon, Jan 01 2007, Andrew Morton wrote:
> >
> > >>The patch would appear to need this fix:
> > >>
> > >>--- a/block/cfq-iosched.c~a
> > >>+++ a/block/cfq-iosched.c
> > >>@@ -592,7 +592,7 @@ static int cfq_allow_merge(request_queue
> > >> if (cfqq == RQ_CFQQ(rq))
> > >> return 1;
> > >>
> > >>- return 1;
> > >>+ return 0;
> > >> }
> > >>
> > >> static inline void
> > >>_
> > >>
> > >>But that might not fix things...
> > >
> > >Yeah it is, but I don't think it'll fix it (if anything, it'll be more
> > >conservative).
> >
> > (to possibly save others from trying -- no, doesn't fix any)
>
> As expected. The issue is rq_is_sync(rq) takes the data direction into
> account as well, while bio_sync() only checks the sync bit. This should
> fix it.

And here a little more relaxed version, as Mark Lord suggested. We allow
merge of async bio into a sync request, but not vice versa.

Both patches pending testing, will do so now.

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 4b4217d..07b7062 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -577,9 +577,9 @@ static int cfq_allow_merge(request_queue
pid_t key;

/*
- * Disallow merge, if bio and rq aren't both sync or async
+ * Disallow merge of a sync bio into an async request.
*/
- if (!!bio_sync(bio) != !!rq_is_sync(rq))
+ if ((bio_data_dir(bio) == READ || bio_sync(bio)) && !rq_is_sync(rq))
return 0;

/*
@@ -592,7 +592,7 @@ static int cfq_allow_merge(request_queue
if (cfqq == RQ_CFQQ(rq))
return 1;

- return 1;
+ return 0;
}

static inline void

--
Jens Axboe