block, bfq: update inject limit only after injection occurred
authorPaolo Valente <paolo.valente@linaro.org>
Thu, 22 Aug 2019 15:20:34 +0000 (17:20 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 18 Sep 2019 02:03:49 +0000 (20:03 -0600)
commit23ed570accc94cf9de9036b71102aa7c0e0e8dc6
tree5c2b7965aa5a4694ffed6b47f30c80333e9f4adb
parent54d4e6ab91eb24b47a58403d8561206e916f0242
block, bfq: update inject limit only after injection occurred

BFQ updates the injection limit of each bfq_queue as a function of how
much the limit inflates the service times experienced by the I/O
requests of the queue. So only service times affected by injection
must be taken into account. Unfortunately, in the current
implementation of this update scheme, the service time of an I/O
request rq not affected by injection may happen to be considered in
the following case: there is no I/O request in service when rq
arrives.

This commit fixes this issue by making sure that only service times
affected by injection are considered for updating the injection
limit. In particular, the service time of an I/O request rq is now
considered only if at least one of the following two conditions holds:
- the destination bfq_queue for rq underwent injection before rq
arrival, and there is still I/O in service in the drive on rq arrival
(the service of such unfinished I/O may delay the service of rq);
- injection occurs between the arrival and the completion time of rq.

Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bfq-iosched.c