block, bfq: always update the budget of an entity when needed
authorPaolo Valente <paolo.valente@linaro.org>
Thu, 16 Aug 2018 16:51:16 +0000 (18:51 +0200)
committerJens Axboe <axboe@kernel.dk>
Thu, 16 Aug 2018 19:08:12 +0000 (13:08 -0600)
When the next child entity to serve changes for a given parent entity,
the budget of that parent entity must be updated accordingly.
Unfortunately, this update is not performed, by mistake, for the
entities that happen to switch from having no child entity to serve,
to having one child entity to serve.

Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bfq-wf2q.c

index dbc07b4560598e3b3aceb5b4d53ebe6c69cafe87..d558fd26740c946c82afdff9df892b9c222d01ef 100644 (file)
@@ -130,10 +130,14 @@ static bool bfq_update_next_in_service(struct bfq_sched_data *sd,
        if (!change_without_lookup) /* lookup needed */
                next_in_service = bfq_lookup_next_entity(sd, expiration);
 
-       if (next_in_service)
-               parent_sched_may_change = !sd->next_in_service ||
+       if (next_in_service) {
+               bool new_budget_triggers_change =
                        bfq_update_parent_budget(next_in_service);
 
+               parent_sched_may_change = !sd->next_in_service ||
+                       new_budget_triggers_change;
+       }
+
        sd->next_in_service = next_in_service;
 
        if (!next_in_service)