Skip to content

Commit 218cb89

Browse files
Algodev-githubaxboe
authored andcommitted
block, bfq: avoid selecting a queue w/o budget
To boost throughput on devices with internal queueing and in scenarios where device idling is not strictly needed, bfq immediately starts serving a new bfq_queue if the in-service bfq_queue remains without pending I/O, even if new I/O may arrive soon for the latter queue. Then, if such I/O actually arrives soon, bfq preempts the new in-service bfq_queue so as to give the previous queue a chance to go on being served (in case the previous queue should actually be the one to be served, according to its timestamps). However, the in-service bfq_queue, say Q, may also be without further budget when it remains also pending I/O. Since bfq changes budgets dynamically to fit the needs of bfq_queues, this happens more often than one may expect. If this happens, then there is no point in trying to go on serving Q when new I/O arrives for it soon: Q would be expired immediately after being selected for service. This would only cause useless overhead. This commit avoids such a useless selection. Signed-off-by: Paolo Valente <paolo.valente@linaro.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 20cd324 commit 218cb89

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

block/bfq-iosched.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,15 @@ static bool bfq_bfqq_update_budg_for_activation(struct bfq_data *bfqd,
13801380
{
13811381
struct bfq_entity *entity = &bfqq->entity;
13821382

1383-
if (bfq_bfqq_non_blocking_wait_rq(bfqq) && arrived_in_time) {
1383+
/*
1384+
* In the next compound condition, we check also whether there
1385+
* is some budget left, because otherwise there is no point in
1386+
* trying to go on serving bfqq with this same budget: bfqq
1387+
* would be expired immediately after being selected for
1388+
* service. This would only cause useless overhead.
1389+
*/
1390+
if (bfq_bfqq_non_blocking_wait_rq(bfqq) && arrived_in_time &&
1391+
bfq_bfqq_budget_left(bfqq) > 0) {
13841392
/*
13851393
* We do not clear the flag non_blocking_wait_rq here, as
13861394
* the latter is used in bfq_activate_bfqq to signal

0 commit comments

Comments
 (0)