diff options
Diffstat (limited to 'block/bfq-sched.c')
-rw-r--r-- | block/bfq-sched.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/block/bfq-sched.c b/block/bfq-sched.c index 475a9a6e1..f8960a4e9 100644 --- a/block/bfq-sched.c +++ b/block/bfq-sched.c @@ -7,7 +7,9 @@ * Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it> * Paolo Valente <paolo.valente@unimore.it> * - * Copyright (C) 2016 Paolo Valente <paolo.valente@unimore.it> + * Copyright (C) 2015 Paolo Valente <paolo.valente@unimore.it> + * + * Copyright (C) 2016 Paolo Valente <paolo.valente@linaro.org> */ static struct bfq_group *bfqq_group(struct bfq_queue *bfqq); @@ -167,7 +169,8 @@ static u64 bfq_delta(unsigned long service, unsigned long weight) static void bfq_calc_finish(struct bfq_entity *entity, unsigned long service) { struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); - unsigned long long start, finish, delta ; + unsigned long long start, finish, delta; + BUG_ON(entity->weight == 0); entity->finish = entity->start + @@ -428,7 +431,7 @@ static void bfq_active_insert(struct bfq_service_tree *st, static unsigned short bfq_ioprio_to_weight(int ioprio) { BUG_ON(ioprio < 0 || ioprio >= IOPRIO_BE_NR); - return (IOPRIO_BE_NR - ioprio) * BFQ_WEIGHT_CONVERSION_COEFF ; + return (IOPRIO_BE_NR - ioprio) * BFQ_WEIGHT_CONVERSION_COEFF; } /** @@ -1243,6 +1246,12 @@ static struct bfq_entity *bfq_lookup_next_entity(struct bfq_sched_data *sd, BUG_ON(sd->in_service_entity); + /* + * Choose from idle class, if needed to guarantee a minimum + * bandwidth to this class. This should also mitigate + * priority-inversion problems in case a low priority task is + * holding file system resources. + */ if (bfqd && jiffies - bfqd->bfq_class_idle_last_service > BFQ_CL_IDLE_TIMEOUT) { @@ -1250,11 +1259,12 @@ static struct bfq_entity *bfq_lookup_next_entity(struct bfq_sched_data *sd, true); if (entity) { struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); + if (bfqq) bfq_log_bfqq(bfqd, bfqq, "idle chosen from st %p %d", st + BFQ_IOPRIO_CLASSES - 1, - BFQ_IOPRIO_CLASSES - 1) ; + BFQ_IOPRIO_CLASSES - 1); #ifdef CONFIG_BFQ_GROUP_IOSCHED else { struct bfq_group *bfqg = @@ -1263,7 +1273,7 @@ static struct bfq_entity *bfq_lookup_next_entity(struct bfq_sched_data *sd, bfq_log_bfqg(bfqd, bfqg, "idle chosen from st %p %d", st + BFQ_IOPRIO_CLASSES - 1, - BFQ_IOPRIO_CLASSES - 1) ; + BFQ_IOPRIO_CLASSES - 1); } #endif i = BFQ_IOPRIO_CLASSES - 1; @@ -1276,10 +1286,11 @@ static struct bfq_entity *bfq_lookup_next_entity(struct bfq_sched_data *sd, if (entity) { if (bfqd != NULL) { struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); + if (bfqq) bfq_log_bfqq(bfqd, bfqq, "chosen from st %p %d", - st + i, i) ; + st + i, i); #ifdef CONFIG_BFQ_GROUP_IOSCHED else { struct bfq_group *bfqg = @@ -1287,7 +1298,7 @@ static struct bfq_entity *bfq_lookup_next_entity(struct bfq_sched_data *sd, bfq_log_bfqg(bfqd, bfqg, "chosen from st %p %d", - st + i, i) ; + st + i, i); } #endif } @@ -1375,8 +1386,9 @@ static void __bfq_bfqd_reset_in_service(struct bfq_data *bfqd) bfqd->in_service_bic = NULL; } + bfq_clear_bfqq_wait_request(bfqd->in_service_queue); + hrtimer_try_to_cancel(&bfqd->idle_slice_timer); bfqd->in_service_queue = NULL; - del_timer(&bfqd->idle_slice_timer); } static void bfq_deactivate_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq, |