]> Pileus Git - ~andy/linux/blobdiff - block/cfq-iosched.c
Merge branch 'linus' into perf/core
[~andy/linux] / block / cfq-iosched.c
index a592afcf1e6daaa037ffead246225fac41040955..069a61017c02c9ee4307a43ba97786f86a1ec196 100644 (file)
@@ -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);
 
        /*