Skip to content

Commit f3218ad

Browse files
Algodev-githubaxboe
authored andcommitted
block, bfq: make sure queue budgets are not below service received
With some unlucky sequences of events, the function bfq_updated_next_req updates the current budget of a bfq_queue to a lower value than the service received by the queue using such a budget. Unfortunately, if this happens, then the return value of the function bfq_bfqq_budget_left becomes inconsistent. This commit solves this problem by lower-bounding the budget computed in bfq_updated_next_req to the service currently charged to the queue. Signed-off-by: Paolo Valente <paolo.valente@linaro.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 218cb89 commit f3218ad

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

block/bfq-iosched.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,8 +907,10 @@ static void bfq_updated_next_req(struct bfq_data *bfqd,
907907
*/
908908
return;
909909

910-
new_budget = max_t(unsigned long, bfqq->max_budget,
911-
bfq_serv_to_charge(next_rq, bfqq));
910+
new_budget = max_t(unsigned long,
911+
max_t(unsigned long, bfqq->max_budget,
912+
bfq_serv_to_charge(next_rq, bfqq)),
913+
entity->service);
912914
if (entity->budget != new_budget) {
913915
entity->budget = new_budget;
914916
bfq_log_bfqq(bfqd, bfqq, "updated next rq: new budget %lu",

0 commit comments

Comments
 (0)