Re: [PATCH v4 1/2] block, bfq: counted root group into 'num_groups_with_pending_reqs'

From: yukuai (C)
Date: Wed Oct 20 2021 - 05:20:36 EST


On 2021/10/20 16:51, Paolo Valente wrote:

@@ -860,9 +870,25 @@ void bfq_weights_tree_remove(struct bfq_data *bfqd,
struct bfq_queue *bfqq)
{
struct bfq_entity *entity = bfqq->entity.parent;
+ struct bfq_sched_data *sd;
+
+ /*
+ * If the bfq queue is in root group, the decrement of
+ * num_groups_with_pending_reqs is performed immediately upon the
+ * deactivation of entity.
+ */
+ if (!entity) {
+ entity = &bfqd->root_group->entity;
+ sd = entity->my_sched_data;
+
+ if (!sd->in_service_entity)
+ bfq_clear_group_with_pending_reqs(bfqd, entity);
+
+ return;
+ }

for_each_entity(entity) {
- struct bfq_sched_data *sd = entity->my_sched_data;
+ sd = entity->my_sched_data;

if (sd->next_in_service || sd->in_service_entity) {
/*
@@ -880,7 +906,8 @@ void bfq_weights_tree_remove(struct bfq_data *bfqd,
}

/*
- * The decrement of num_groups_with_pending_reqs is
+ * If the bfq queue is not in root group,
+ * the decrement of num_groups_with_pending_reqs is


I'm sorry if I didn't notice this before, but why do you postpone the
decrement only for queues not in root group? If I'm not missing
anything, the active (i.e., with pending reqs) state of the root group
is to be computed as that of ay other group.

Hi, Paolo

I thought if queue is in root group, then bfqq->entity.parent is NULL,
and such case is handled above, which is separate from previous
implementation for queues that are not in root group.

Is this the wrong way to handle root group?

Thanks,
Kuai