Re: Poor read performance when sequential write presents

From: Jens Axboe (axboe@suse.de)
Date: Tue May 28 2002 - 04:36:44 EST


On Tue, May 28 2002, Jens Axboe wrote:
> > hmm. Actually the code looks a bit odd:
> >
> > if (elv_linus_sequence(__rq)-- <= 0)
> > break;
> > if (!(__rq->flags & REQ_CMD))
> > continue;
> > if (elv_linus_sequence(__rq) < bio_sectors(bio))
> > break;
> >
> > The first decrement is saying that elv_linus_sequence is in units of
> > requests, but the comparison (and the later `-= bio_sectors()') seems
> > to be saying it's in units of sectors.
>
> Well, it really is in units of sectors in 2.5, the first decrement is a
> scan aging measure.

Something like this make more sense.

diff -Nru a/drivers/block/elevator.c b/drivers/block/elevator.c
--- a/drivers/block/elevator.c Tue May 28 11:33:38 2002
+++ b/drivers/block/elevator.c Tue May 28 11:33:38 2002
@@ -174,21 +174,8 @@
         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
- */
- if (elv_linus_sequence(__rq)-- <= 0)
- break;
                 if (!(__rq->flags & REQ_CMD))
                         continue;
- if (elv_linus_sequence(__rq) < bio_sectors(bio))
- break;
-
- if (!*req && bio_rq_in_between(bio, __rq, &q->queue_head))
- *req = __rq;
 
                 if ((ret = elv_try_merge(__rq, bio))) {
                         if (ret == ELEVATOR_FRONT_MERGE)
@@ -197,6 +184,15 @@
                         q->last_merge = &__rq->queuelist;
                         break;
                 }
+
+ if (elv_linus_sequence(__rq) < bio_sectors(bio))
+ break;
+
+ if (!*req && bio_rq_in_between(bio, __rq, &q->queue_head))
+ *req = __rq;
+
+ if (__rq->flags & (REQ_BARRIER | REQ_STARTED))
+ break;
         }
 
         return ret;

which basically only accounts seeks (sequence is still in sectors but
that doesn't matter). We will always try and merge (don't worry,
rq_mergeable() will check barrier and started bits), the sequence check
is postponed until right before the insertion check.

-- 
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/



This archive was generated by hypermail 2b29 : Fri May 31 2002 - 22:00:21 EST