]> git.baikalelectronics.ru Git - kernel.git/commit
bfq: Avoid false bfq queue merging
authorJan Kara <jack@suse.cz>
Fri, 5 Jun 2020 14:16:16 +0000 (16:16 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 27 Jan 2021 16:15:38 +0000 (09:15 -0700)
commit22f5eda52abaac91579ea888922bdc6d225b47dd
tree470e919856dcf53ea851f883e705983580b7b131
parente1aebf870fd58592b7862d5ccc709e8f6c4c3e55
bfq: Avoid false bfq queue merging

bfq_setup_cooperator() uses bfqd->in_serv_last_pos so detect whether it
makes sense to merge current bfq queue with the in-service queue.
However if the in-service queue is freshly scheduled and didn't dispatch
any requests yet, bfqd->in_serv_last_pos is stale and contains value
from the previously scheduled bfq queue which can thus result in a bogus
decision that the two queues should be merged. This bug can be observed
for example with the following fio jobfile:

[global]
direct=0
ioengine=sync
invalidate=1
size=1g
rw=read

[reader]
numjobs=4
directory=/mnt

where the 4 processes will end up in the one shared bfq queue although
they do IO to physically very distant files (for some reason I was able to
observe this only with slice_idle=1ms setting).

Fix the problem by invalidating bfqd->in_serv_last_pos when switching
in-service queue.

Fixes: 48122108789c ("block, bfq: fix in-service-queue check for queue merging")
CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bfq-iosched.c