@@ -557,6 +557,7 @@ static void bfq_pd_init(struct blkg_policy_data *pd)
*/
bfqg->bfqd = bfqd;
bfqg->active_entities = 0;
+ bfqg->busy_queues = 0;
bfqg->online = true;
bfqg->rq_pos_tree = RB_ROOT;
}
@@ -907,6 +907,7 @@ struct bfq_group_data {
* are groups with more than one active @bfq_entity
* (see the comments to the function
* bfq_bfqq_may_idle()).
+ * @busy_queues: number of busy bfqqs.
* @rq_pos_tree: rbtree sorted by next_request position, used when
* determining if two or more queues have interleaving
* requests (see bfq_find_close_cooperator()).
@@ -943,6 +944,7 @@ struct bfq_group {
struct bfq_entity *my_entity;
int active_entities;
+ int busy_queues;
struct rb_root rq_pos_tree;
@@ -218,6 +218,18 @@ static bool bfq_no_longer_next_in_service(struct bfq_entity *entity)
return false;
}
+static void bfq_inc_busy_queues(struct bfq_queue *bfqq)
+{
+ bfqq->bfqd->busy_queues[bfqq->ioprio_class - 1]++;
+ bfqq_group(bfqq)->busy_queues++;
+}
+
+static void bfq_dec_busy_queues(struct bfq_queue *bfqq)
+{
+ bfqq->bfqd->busy_queues[bfqq->ioprio_class - 1]--;
+ bfqq_group(bfqq)->busy_queues--;
+}
+
#else /* CONFIG_BFQ_GROUP_IOSCHED */
static bool bfq_update_parent_budget(struct bfq_entity *next_in_service)
@@ -230,6 +242,16 @@ static bool bfq_no_longer_next_in_service(struct bfq_entity *entity)
return true;
}
+static void bfq_inc_busy_queues(struct bfq_queue *bfqq)
+{
+ bfqq->bfqd->busy_queues[bfqq->ioprio_class - 1]++;
+}
+
+static void bfq_dec_busy_queues(struct bfq_queue *bfqq)
+{
+ bfqq->bfqd->busy_queues[bfqq->ioprio_class - 1]--;
+}
+
#endif /* CONFIG_BFQ_GROUP_IOSCHED */
/*
@@ -1659,7 +1681,7 @@ void bfq_del_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq,
bfq_clear_bfqq_busy(bfqq);
- bfqd->busy_queues[bfqq->ioprio_class - 1]--;
+ bfq_dec_busy_queues(bfqq);
if (bfqq->wr_coeff > 1)
bfqd->wr_busy_queues--;
@@ -1682,7 +1704,7 @@ void bfq_add_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq)
bfq_activate_bfqq(bfqd, bfqq);
bfq_mark_bfqq_busy(bfqq);
- bfqd->busy_queues[bfqq->ioprio_class - 1]++;
+ bfq_inc_busy_queues(bfqq);
if (!bfqq->dispatched)
if (bfqq->wr_coeff == 1)