* [PATCH] cfq-iosched: fix slice_left calculation
@ 2005-11-10 14:00 Tejun Heo
2005-11-10 17:10 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Tejun Heo @ 2005-11-10 14:00 UTC (permalink / raw)
To: axboe, linux-kernel
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 <htejun@gmail.com>
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -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;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] cfq-iosched: fix slice_left calculation
2005-11-10 14:00 [PATCH] cfq-iosched: fix slice_left calculation Tejun Heo
@ 2005-11-10 17:10 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2005-11-10 17:10 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-kernel
On Thu, Nov 10 2005, Tejun Heo wrote:
> 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 <htejun@gmail.com>
>
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -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.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-11-10 17:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-10 14:00 [PATCH] cfq-iosched: fix slice_left calculation Tejun Heo
2005-11-10 17:10 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox