diff options
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r-- | block/cfq-iosched.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 8427697c5437..501ffdf0399c 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -598,8 +598,8 @@ cfq_group_slice(struct cfq_data *cfqd, struct cfq_group *cfqg) | |||
598 | return cfq_target_latency * cfqg->weight / st->total_weight; | 598 | return cfq_target_latency * cfqg->weight / st->total_weight; |
599 | } | 599 | } |
600 | 600 | ||
601 | static inline void | 601 | static inline unsigned |
602 | cfq_set_prio_slice(struct cfq_data *cfqd, struct cfq_queue *cfqq) | 602 | cfq_scaled_group_slice(struct cfq_data *cfqd, struct cfq_queue *cfqq) |
603 | { | 603 | { |
604 | unsigned slice = cfq_prio_to_slice(cfqd, cfqq); | 604 | unsigned slice = cfq_prio_to_slice(cfqd, cfqq); |
605 | if (cfqd->cfq_latency) { | 605 | if (cfqd->cfq_latency) { |
@@ -625,6 +625,14 @@ cfq_set_prio_slice(struct cfq_data *cfqd, struct cfq_queue *cfqq) | |||
625 | low_slice); | 625 | low_slice); |
626 | } | 626 | } |
627 | } | 627 | } |
628 | return slice; | ||
629 | } | ||
630 | |||
631 | static inline void | ||
632 | cfq_set_prio_slice(struct cfq_data *cfqd, struct cfq_queue *cfqq) | ||
633 | { | ||
634 | unsigned slice = cfq_scaled_group_slice(cfqd, cfqq); | ||
635 | |||
628 | cfqq->slice_start = jiffies; | 636 | cfqq->slice_start = jiffies; |
629 | cfqq->slice_end = jiffies + slice; | 637 | cfqq->slice_end = jiffies + slice; |
630 | cfqq->allocated_slice = slice; | 638 | cfqq->allocated_slice = slice; |
@@ -1661,8 +1669,11 @@ __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
1661 | /* | 1669 | /* |
1662 | * store what was left of this slice, if the queue idled/timed out | 1670 | * store what was left of this slice, if the queue idled/timed out |
1663 | */ | 1671 | */ |
1664 | if (timed_out && !cfq_cfqq_slice_new(cfqq)) { | 1672 | if (timed_out) { |
1665 | cfqq->slice_resid = cfqq->slice_end - jiffies; | 1673 | if (cfq_cfqq_slice_new(cfqq)) |
1674 | cfqq->slice_resid = cfq_scaled_group_slice(cfqd, cfqq); | ||
1675 | else | ||
1676 | cfqq->slice_resid = cfqq->slice_end - jiffies; | ||
1666 | cfq_log_cfqq(cfqd, cfqq, "resid=%ld", cfqq->slice_resid); | 1677 | cfq_log_cfqq(cfqd, cfqq, "resid=%ld", cfqq->slice_resid); |
1667 | } | 1678 | } |
1668 | 1679 | ||
@@ -3284,10 +3295,19 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, | |||
3284 | */ | 3295 | */ |
3285 | static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq) | 3296 | static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq) |
3286 | { | 3297 | { |
3298 | struct cfq_queue *old_cfqq = cfqd->active_queue; | ||
3299 | |||
3287 | cfq_log_cfqq(cfqd, cfqq, "preempt"); | 3300 | cfq_log_cfqq(cfqd, cfqq, "preempt"); |
3288 | cfq_slice_expired(cfqd, 1); | 3301 | cfq_slice_expired(cfqd, 1); |
3289 | 3302 | ||
3290 | /* | 3303 | /* |
3304 | * workload type is changed, don't save slice, otherwise preempt | ||
3305 | * doesn't happen | ||
3306 | */ | ||
3307 | if (cfqq_type(old_cfqq) != cfqq_type(cfqq)) | ||
3308 | cfqq->cfqg->saved_workload_slice = 0; | ||
3309 | |||
3310 | /* | ||
3291 | * Put the new queue at the front of the of the current list, | 3311 | * Put the new queue at the front of the of the current list, |
3292 | * so we know that it will be selected next. | 3312 | * so we know that it will be selected next. |
3293 | */ | 3313 | */ |