* [PATCH 0/3] Deadline iosched: Fix batching algorithm
@ 2007-10-30 4:03 Aaron Carroll
2007-10-30 4:05 ` [PATCH 1/3] Deadline iosched: Factor out finding latter request Aaron Carroll
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Aaron Carroll @ 2007-10-30 4:03 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel, Peter Chubb
Hi Jens,
The following patches correct some issues with the deadline I/O
scheduler and its batching algorithm.
Patch 1 is a simple function factorisation.
Patch 2 fixes a missing batch count reset, making the behaviour
closer to that implied by the documentation.
Patch 3 changes batch start points to resolve a disparity in
latency and bandwidth between high- and low-sector requests.
Thanks,
-- Aaron
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] Deadline iosched: Factor out finding latter request
2007-10-30 4:03 [PATCH 0/3] Deadline iosched: Fix batching algorithm Aaron Carroll
@ 2007-10-30 4:05 ` Aaron Carroll
2007-10-30 4:05 ` [PATCH 2/3] Deadline iosched: Reset batch for ordered requests Aaron Carroll
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Aaron Carroll @ 2007-10-30 4:05 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel, Peter Chubb
Factor finding the next request in sector-sorted order into
a function deadline_latter_request.
Signed-off-by: Aaron Carroll <aaronc@gelato.unsw.edu.au>
---
block/deadline-iosched.c | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c
index 1a511ff..a44437e 100644
--- a/block/deadline-iosched.c
+++ b/block/deadline-iosched.c
@@ -55,6 +55,20 @@ static void deadline_move_request(struct deadline_data *, struct request *);
#define RQ_RB_ROOT(dd, rq) (&(dd)->sort_list[rq_data_dir((rq))])
+/*
+ * get the request after `rq' in sector-sorted order
+ */
+static inline struct request *
+deadline_latter_request(struct request *rq)
+{
+ struct rb_node *node = rb_next(&rq->rb_node);
+
+ if (node)
+ return rb_entry_rq(node);
+
+ return NULL;
+}
+
static void
deadline_add_rq_rb(struct deadline_data *dd, struct request *rq)
{
@@ -74,13 +88,8 @@ deadline_del_rq_rb(struct deadline_data *dd, struct request *rq)
{
const int data_dir = rq_data_dir(rq);
- if (dd->next_rq[data_dir] == rq) {
- struct rb_node *rbnext = rb_next(&rq->rb_node);
-
- dd->next_rq[data_dir] = NULL;
- if (rbnext)
- dd->next_rq[data_dir] = rb_entry_rq(rbnext);
- }
+ if (dd->next_rq[data_dir] == rq)
+ dd->next_rq[data_dir] = deadline_latter_request(rq);
elv_rb_del(RQ_RB_ROOT(dd, rq), rq);
}
@@ -198,14 +207,11 @@ static void
deadline_move_request(struct deadline_data *dd, struct request *rq)
{
const int data_dir = rq_data_dir(rq);
- struct rb_node *rbnext = rb_next(&rq->rb_node);
dd->next_rq[READ] = NULL;
dd->next_rq[WRITE] = NULL;
+ dd->next_rq[data_dir] = deadline_latter_request(rq);
- if (rbnext)
- dd->next_rq[data_dir] = rb_entry_rq(rbnext);
-
dd->last_sector = rq->sector + rq->nr_sectors;
/*
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] Deadline iosched: Reset batch for ordered requests
2007-10-30 4:03 [PATCH 0/3] Deadline iosched: Fix batching algorithm Aaron Carroll
2007-10-30 4:05 ` [PATCH 1/3] Deadline iosched: Factor out finding latter request Aaron Carroll
@ 2007-10-30 4:05 ` Aaron Carroll
2007-10-30 4:06 ` [PATCH 3/3] Deadline iosched: Fix batching fairness Aaron Carroll
2007-10-30 9:40 ` [PATCH 0/3] Deadline iosched: Fix batching algorithm Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: Aaron Carroll @ 2007-10-30 4:05 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel, Peter Chubb
The deadline I/O scheduler does not reset the batch count when starting
a new batch at a higher-sectored request. This means the second and
subsequent batch in the same data direction will never exceed a single
request in size whenever higher-sectored requests are pending.
This patch gives new batches in the same data direction as old ones
their full quota of requests by resetting the batch count.
Signed-off-by: Aaron Carroll <aaronc@gelato.unsw.edu.au>
---
block/deadline-iosched.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c
index a44437e..cb94c83 100644
--- a/block/deadline-iosched.c
+++ b/block/deadline-iosched.c
@@ -306,12 +306,11 @@ 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 */
- dd->batching = 0;
rq = rq_entry_fifo(dd->fifo_list[data_dir].next);
-
} else if (dd->next_rq[data_dir]) {
/*
* The last req was the same dir and we have a next request in
@@ -325,12 +324,13 @@ dispatch_find_request:
* higher-sectored requests. Go back to the lowest sectored
* request (1 way elevator) and start a new batch.
*/
- dd->batching = 0;
node = rb_first(&dd->sort_list[data_dir]);
if (node)
rq = rb_entry_rq(node);
}
+ dd->batching = 0;
+
dispatch_request:
/*
* rq is the selected appropriate request.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] Deadline iosched: Fix batching fairness
2007-10-30 4:03 [PATCH 0/3] Deadline iosched: Fix batching algorithm Aaron Carroll
2007-10-30 4:05 ` [PATCH 1/3] Deadline iosched: Factor out finding latter request Aaron Carroll
2007-10-30 4:05 ` [PATCH 2/3] Deadline iosched: Reset batch for ordered requests Aaron Carroll
@ 2007-10-30 4:06 ` Aaron Carroll
2007-10-30 9:40 ` [PATCH 0/3] Deadline iosched: Fix batching algorithm Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: Aaron Carroll @ 2007-10-30 4:06 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel, Peter Chubb
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>
---
block/deadline-iosched.c | 21 +++++++--------------
1 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c
index cb94c83..a054eef 100644
--- a/block/deadline-iosched.c
+++ b/block/deadline-iosched.c
@@ -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;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] Deadline iosched: Fix batching algorithm
2007-10-30 4:03 [PATCH 0/3] Deadline iosched: Fix batching algorithm Aaron Carroll
` (2 preceding siblings ...)
2007-10-30 4:06 ` [PATCH 3/3] Deadline iosched: Fix batching fairness Aaron Carroll
@ 2007-10-30 9:40 ` Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2007-10-30 9:40 UTC (permalink / raw)
To: Aaron Carroll; +Cc: linux-kernel, Peter Chubb
On Tue, Oct 30 2007, Aaron Carroll wrote:
> Hi Jens,
>
> The following patches correct some issues with the deadline I/O
> scheduler and its batching algorithm.
>
> Patch 1 is a simple function factorisation.
> Patch 2 fixes a missing batch count reset, making the behaviour
> closer to that implied by the documentation.
1+2 are no brainers, applied.
> Patch 3 changes batch start points to resolve a disparity in
> latency and bandwidth between high- and low-sector requests.
This one makes a lot of sense, applied as well.
Thanks!
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-10-30 9:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-30 4:03 [PATCH 0/3] Deadline iosched: Fix batching algorithm Aaron Carroll
2007-10-30 4:05 ` [PATCH 1/3] Deadline iosched: Factor out finding latter request Aaron Carroll
2007-10-30 4:05 ` [PATCH 2/3] Deadline iosched: Reset batch for ordered requests Aaron Carroll
2007-10-30 4:06 ` [PATCH 3/3] Deadline iosched: Fix batching fairness Aaron Carroll
2007-10-30 9:40 ` [PATCH 0/3] Deadline iosched: Fix batching algorithm Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.