diff options
author | Corrado Zoccolo <czoccolo@gmail.com> | 2009-10-08 08:43:32 +0200 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-10-08 08:43:32 +0200 |
commit | 355b659c87432a4e76160640625c47fcf9174e8d (patch) | |
tree | 1121f7c4ae13643a30abaf6091312f5b116a52bc /block/cfq-iosched.c | |
parent | a6151c3a5c8e1ff5a28450bc8d6a99a2a0add0a7 (diff) | |
download | linux-stable-355b659c87432a4e76160640625c47fcf9174e8d.tar.gz linux-stable-355b659c87432a4e76160640625c47fcf9174e8d.tar.bz2 linux-stable-355b659c87432a4e76160640625c47fcf9174e8d.zip |
cfq-iosched: avoid probable slice overrun when idling
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 <czoccolo@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r-- | block/cfq-iosched.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index a592afcf1e6d..069a61017c02 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -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); /* |