mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li@intel.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: Jens Axboe <jaxboe@fusionio.com>, vgoyal@redhat.com
Subject: [RFC]block: change sort order of elv_dispatch_sort
Date: Wed, 08 Dec 2010 13:42:02 +0800	[thread overview]
Message-ID: <1291786922.12777.152.camel@sli10-conroe> (raw)

Change the sort order a little bit. Makes requests with sector above boundary
in ascendant order, and requests with sector below boundary in descendant
order. The goal is we have less disk spindle move.
For example, boundary is 7, we add sector 8, 1, 9, 2, 3, 4, 10, 12, 5, 11, 6
In the original sort, the sorted list is:
8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6
the spindle move is 8->12->1->6, total movement is 12*2 sectors
with the new sort, the list is:
8, 9, 10, 11, 12, 6, 5, 4, 3, 2, 1
the spindle move is 8->12->6->1, total movement is 12*1.5 sectors

Signed-off-by: Shaohua Li <shaohua.li@intel.com>

diff --git a/block/elevator.c b/block/elevator.c
index 2569512..1e01e49 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -443,12 +443,12 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)
 		if (blk_rq_pos(rq) >= boundary) {
 			if (blk_rq_pos(pos) < boundary)
 				continue;
+			if (blk_rq_pos(rq) >= blk_rq_pos(pos))
+				break;
 		} else {
-			if (blk_rq_pos(pos) >= boundary)
+			if (blk_rq_pos(rq) < blk_rq_pos(pos))
 				break;
 		}
-		if (blk_rq_pos(rq) >= blk_rq_pos(pos))
-			break;
 	}
 
 	list_add(&rq->queuelist, entry);



             reply	other threads:[~2010-12-08  5:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-08  5:42 Shaohua Li [this message]
2010-12-08  6:56 ` Jens Axboe
2010-12-08  7:50   ` Shaohua Li
2010-12-08  8:01     ` Jens Axboe
2010-12-08 14:39       ` Shaohua Li
2010-12-08 14:44         ` Jens Axboe
2010-12-09 13:17           ` Shaohua Li

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=1291786922.12777.152.camel@sli10-conroe \
    --to=shaohua.li@intel.com \
    --cc=jaxboe@fusionio.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vgoyal@redhat.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

Powered by JetHome