]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
Deadline iosched: Fix batching fairness
authorAaron Carroll <aaronc@gelato.unsw.edu.au>
Tue, 30 Oct 2007 09:40:13 +0000 (10:40 +0100)
committerJens Axboe <axboe@carl.home.kernel.dk>
Fri, 2 Nov 2007 07:47:25 +0000 (08:47 +0100)
After switching data directions, deadline always starts the next batch
from the lowest-sector request.  This gives excessive deadline expiries
and large latency and throughput disparity between high- and low-sector
requests; an order of magnitude in some tests.

This patch changes the batching behaviour so new batches start from the
request whose expiry is earliest.

Signed-off-by: Aaron Carroll <aaronc@gelato.unsw.edu.au>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/deadline-iosched.c

index cb94c838087a75f544df130bb51873270b55fa25..a054eef8dff63c19548f74e8d2b58db78e704822 100644 (file)
@@ -306,27 +306,20 @@ dispatch_writes:
 dispatch_find_request:
        /*
         * we are not running a batch, find best request for selected data_dir
-        * and start a new batch
         */
-       if (deadline_check_fifo(dd, data_dir)) {
-               /* An expired request exists - satisfy it */
+       if (deadline_check_fifo(dd, data_dir) || !dd->next_rq[data_dir]) {
+               /*
+                * A deadline has expired, the last request was in the other
+                * direction, or we have run out of higher-sectored requests.
+                * Start again from the request with the earliest expiry time.
+                */
                rq = rq_entry_fifo(dd->fifo_list[data_dir].next);
-       } else if (dd->next_rq[data_dir]) {
+       } else {
                /*
                 * The last req was the same dir and we have a next request in
                 * sort order. No expired requests so continue on from here.
                 */
                rq = dd->next_rq[data_dir];
-       } else {
-               struct rb_node *node;
-               /*
-                * The last req was the other direction or we have run out of
-                * higher-sectored requests. Go back to the lowest sectored
-                * request (1 way elevator) and start a new batch.
-                */
-               node = rb_first(&dd->sort_list[data_dir]);
-               if (node)
-                       rq = rb_entry_rq(node);
        }
 
        dd->batching = 0;