summaryrefslogtreecommitdiff
path: root/block/cfq-iosched.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-10-06 20:53:44 +0200
committerJens Axboe <jens.axboe@oracle.com>2009-10-06 21:09:32 +0200
commitb9c8946b192397394a0ccd4fcecb31bc060f79f8 (patch)
tree54169a387e8e4a5f6f79e06de6fbdd0096198069 /block/cfq-iosched.c
parent0b182d617eb50762b483658dd6dd9a9fbcb25758 (diff)
downloadlwn-b9c8946b192397394a0ccd4fcecb31bc060f79f8.tar.gz
lwn-b9c8946b192397394a0ccd4fcecb31bc060f79f8.zip
cfq-iosched: fix the slice residual sign
We should subtract the slice residual from the rb tree key, since a negative residual count indicates that the cfqq overran its slice the last time. Hence we want to add the overrun time, to position it a bit further away in the service tree. Reported-by: Corrado Zoccolo <czoccolo@gmail.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r--block/cfq-iosched.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 5c3cee93329a..4ab33d8a20b2 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -507,8 +507,14 @@ static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq,
} else
rb_key += jiffies;
} else if (!add_front) {
+ /*
+ * Get our rb key offset. Subtract any residual slice
+ * value carried from last service. A negative resid
+ * count indicates slice overrun, and this should position
+ * the next service time further away in the tree.
+ */
rb_key = cfq_slice_offset(cfqd, cfqq) + jiffies;
- rb_key += cfqq->slice_resid;
+ rb_key -= cfqq->slice_resid;
cfqq->slice_resid = 0;
} else {
rb_key = -HZ;