aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-10-06 14:53:44 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-10-06 15:09:32 -0400
commitb9c8946b192397394a0ccd4fcecb31bc060f79f8 (patch)
tree54169a387e8e4a5f6f79e06de6fbdd0096198069
parent0b182d617eb50762b483658dd6dd9a9fbcb25758 (diff)
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>
-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,
507 } else 507 } else
508 rb_key += jiffies; 508 rb_key += jiffies;
509 } else if (!add_front) { 509 } else if (!add_front) {
510 /*
511 * Get our rb key offset. Subtract any residual slice
512 * value carried from last service. A negative resid
513 * count indicates slice overrun, and this should position
514 * the next service time further away in the tree.
515 */
510 rb_key = cfq_slice_offset(cfqd, cfqq) + jiffies; 516 rb_key = cfq_slice_offset(cfqd, cfqq) + jiffies;
511 rb_key += cfqq->slice_resid; 517 rb_key -= cfqq->slice_resid;
512 cfqq->slice_resid = 0; 518 cfqq->slice_resid = 0;
513 } else { 519 } else {
514 rb_key = -HZ; 520 rb_key = -HZ;