cfq-iosched: fix slice_left calculation
PATCH 1/1 cfq-iosched: fix slice_left calculation
When cfq slice expires, remainder of slice is calculated and stored in cfqq->slice_left. Current code calculates the opposite of remainder - how many jiffies the cfqq has used past slice end. This patch fixes the bug.
Signed-off-by Tejun Heo <[email protected]>
block/cfq-iosched.c +2 -2
@@ -861,8 +861,8 @@ __cfq_slice_expired(struct cfq_data *cfq* store what was left of this slice, if the queue idled out * or was preempted */ -if (time_after (now, cfqq->slice_end)) - cfqq->slice_left = now - cfqq->slice_end; +if (time_after (cfqq->slice_end, now)) + cfqq->slice_left = cfqq->slice_end - now;else cfqq->slice_left =0 ;
Quoted 11 lines · Tejun Heo
When cfq slice expires, remainder of slice is calculated and stored in
cfqq->slice_left. Current code calculates the opposite of remainder - how many jiffies the cfqq has used past slice end. This patch fixes the bug.Signed-off-by Tejun Heo <[email protected]>
block/cfq-iosched.c __cfq_slice_expired(struct cfq_data *cfq · line 867
Quoted 9 lines
block/cfq-iosched.c +2
-2@@ -861,8 +861,8 @@ __cfq_slice_expired(struct cfq_data *cfq* store what was left of this slice, if the queue idled out * or was preempted */ -if (time_after (now, cfqq->slice_end)) - cfqq->slice_left = now - cfqq->slice_end; +if (time_after (cfqq->slice_end, now)) + cfqq->slice_left = cfqq->slice_end - now;else cfqq->slice_left =0 ;
That looks more correct, good spotting. Applied.
Signature · 1 line
Jens Axboe