diff mbox series

[1/3] bfq: Avoid false bfq queue merging

Message ID 20210113100937.8278-1-jack@suse.cz (mailing list archive)
State New, archived
Headers show
Series [1/3] bfq: Avoid false bfq queue merging | expand

Commit Message

Jan Kara Jan. 13, 2021, 10:09 a.m. UTC
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:



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: 058fdecc6de7 ("block, bfq: fix in-service-queue check for queue merging")
CC: stable@vger.kernel.org
Acked-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Jan Kara <jack@suse.cz>
 block/bfq-iosched.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series


diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 9e4eb0fc1c16..dc5f12d0d482 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -2937,6 +2937,7 @@  static void __bfq_set_in_service_queue(struct bfq_data *bfqd,
 	bfqd->in_service_queue = bfqq;
+	bfqd->in_serv_last_pos = -1;