public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Andrew Morton <akpm@zip.com.au>
Cc: William Lee Irwin III <wli@holomorphy.com>,
	Giuliano Pochini <pochini@shiny.it>,
	linux-kernel@vger.kernel.org, "chen,
	xiangping" <chen_xiangping@emc.com>
Subject: Re: Poor read performance when sequential write presents
Date: Tue, 28 May 2002 11:36:44 +0200	[thread overview]
Message-ID: <20020528093644.GA8539@suse.de> (raw)
In-Reply-To: <3CED4843.2783B568@zip.com.au> <XFMail.20020524105942.pochini@shiny.it> <3CEE0758.27110CAD@zip.com.au> <20020524094606.GH14918@holomorphy.com> <3CEE1035.1E67E1B8@zip.com.au> <20020527080632.GC17674@suse.de> <3CF1ECD1.A1BB2CF1@zip.com.au> <20020527085414.GD17674@suse.de> <3CF1FDF8.B775DF44@zip.com.au> <20020528092503.GJ17674@suse.de>

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


      reply	other threads:[~2002-05-28  9:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-23 14:20 Poor read performance when sequential write presents chen, xiangping
2002-05-23 19:51 ` Andrew Morton
2002-05-24  8:59   ` Giuliano Pochini
2002-05-24  9:26     ` Andrew Morton
2002-05-24  9:46       ` William Lee Irwin III
2002-05-24 10:04         ` Andrew Morton
2002-05-27  8:06           ` Jens Axboe
2002-05-27  8:22             ` Andrew Morton
2002-05-27  8:54               ` Jens Axboe
2002-05-27  9:35                 ` Andrew Morton
2002-05-28  9:25                   ` Jens Axboe
2002-05-28  9:36                     ` Jens Axboe [this message]

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=20020528093644.GA8539@suse.de \
    --to=axboe@suse.de \
    --cc=akpm@zip.com.au \
    --cc=chen_xiangping@emc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pochini@shiny.it \
    --cc=wli@holomorphy.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