aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2011-01-14 02:41:03 -0500
committerJens Axboe <jaxboe@fusionio.com>2011-01-14 02:41:03 -0500
commitc553f8e335c00a7cff3ab3f13e793b13d3f2207f (patch)
treef9371c9e1191711dd2e774e04d99f3fa90d697fa
parentf8ae6e3eb8251be32c6e913393d9f8d9e0609489 (diff)
block cfq: compensate preempted queue even if it has no slice assigned
If a queue is preempted before it gets slice assigned, the queue doesn't get compensation, which looks unfair. For such queue, we compensate it for a whole slice. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
-rw-r--r--block/cfq-iosched.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 7bfea53c1bb5..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
601static inline void 601static inline unsigned
602cfq_set_prio_slice(struct cfq_data *cfqd, struct cfq_queue *cfqq) 602cfq_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
631static inline void
632cfq_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