Re: Poor read performance when sequential write presents

Jens Axboe (axboe@suse.de)
Mon, 27 May 2002 10:54:14 +0200


On Mon, May 27 2002, Andrew Morton wrote:
> Jens Axboe wrote:
> >
> > ...
> > > But in 2.5, head-activeness went away and as far as I know, IDE and SCSI are
> > > treated the same. Odd.
> >
> > It didn't really go away, it just gets handled automatically now.
> > elv_next_request() marks the request as started, in which case the i/o
> > scheduler won't consider it for merging etc. SCSI removes the request
> > directly after it has been marked started, while IDE leaves it on the
> > queue until it completes. For IDE TCQ, the behaviour is the same as with
> > SCSI.
>
> It won't consider the active request at the head of the queue for
> merging (making the request larger). But it _could_ consider the
> request when making decisions about insertion (adding a new request
> at the head of the queue because it's close-on-disk to the active
> one). Does it do that?

Only when the front request isn't active is it safe to consider
insertion in front of it. 2.5 does that exactly because it knows if the
request has been started, while 2.4 has to guess by looking at the
head-active flag and the plug status.

If the request is started, we will only consider placing in front of the
2nd request not after the 1st. We could consider in between 1st and 2nd,
that should be safe. In fact that should be perfectly safe, just move
the barrier and started test down after the insert test. *req is the
insert-after point.

diff -Nru a/drivers/block/elevator.c b/drivers/block/elevator.c
--- a/drivers/block/elevator.c Mon May 27 10:53:53 2002
+++ b/drivers/block/elevator.c Mon May 27 10:53:53 2002
@@ -174,9 +174,6 @@
while ((entry = entry->prev) != &q->queue_head) {
__rq = list_entry_rq(entry);

- if (__rq->flags & (REQ_BARRIER | REQ_STARTED))
- break;
-
/*
* simply "aging" of requests in queue
*/
@@ -189,6 +186,9 @@

if (!*req && bio_rq_in_between(bio, __rq, &q->queue_head))
*req = __rq;
+
+ if (__rq->flags & (REQ_BARRIER | REQ_STARTED))
+ break;

if ((ret = elv_try_merge(__rq, bio))) {
if (ret == ELEVATOR_FRONT_MERGE)

-- 
Jens Axboe

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/