Skip to content
Snippets Groups Projects
Commit b9c8946b authored by Jens Axboe's avatar Jens Axboe
Browse files

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: default avatarCorrado Zoccolo <czoccolo@gmail.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 0b182d61
No related branches found
No related tags found
No related merge requests found
...@@ -507,8 +507,14 @@ static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq, ...@@ -507,8 +507,14 @@ static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq,
} else } else
rb_key += jiffies; rb_key += jiffies;
} else if (!add_front) { } 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 = cfq_slice_offset(cfqd, cfqq) + jiffies;
rb_key += cfqq->slice_resid; rb_key -= cfqq->slice_resid;
cfqq->slice_resid = 0; cfqq->slice_resid = 0;
} else { } else {
rb_key = -HZ; rb_key = -HZ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment