Skip to content

Commit

Permalink
cfq-iosched: avoid probable slice overrun when idling
Browse files Browse the repository at this point in the history
If the average think time is larger than the remaining time slice
for any given queue, don't allow it to idle. A succesful idle also
means that we need to dispatch and complete a request, so if we don't
even have time left for the idle process, we would overrun the slice
in any case.

Signed-off-by: Corrado Zoccolo <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
czoccolo authored and Jens Axboe committed Oct 8, 2009
1 parent a6151c3 commit 355b659
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,15 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd)
if (!cic || !atomic_read(&cic->ioc->nr_tasks))
return;

/*
* If our average think time is larger than the remaining time
* slice, then don't idle. This avoids overrunning the allotted
* time slice.
*/
if (sample_valid(cic->ttime_samples) &&
(cfqq->slice_end - jiffies < cic->ttime_mean))
return;

cfq_mark_cfqq_wait_request(cfqq);

/*
Expand Down

0 comments on commit 355b659

Please sign in to comment.