block, bfq: keep shared queues out of the waker mechanism
authorPaolo Valente <paolo.valente@linaro.org>
Thu, 4 Mar 2021 17:46:26 +0000 (18:46 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 25 Mar 2021 16:50:07 +0000 (10:50 -0600)
Shared queues are likely to receive I/O at a high rate. This may
deceptively let them be considered as wakers of other queues. But a
false waker will unjustly steal bandwidth to its supposedly woken
queue. So considering also shared queues in the waking mechanism may
cause more control troubles than throughput benefits. This commit
keeps shared queues out of the waker-detection mechanism.

Tested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Link: https://lore.kernel.org/r/20210304174627.161-6-paolo.valente@linaro.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bfq-iosched.c

index 2a84294..a3f59d3 100644 (file)
@@ -5860,7 +5860,17 @@ static void bfq_completed_request(struct bfq_queue *bfqq, struct bfq_data *bfqd)
                        1UL<<(BFQ_RATE_SHIFT - 10))
                bfq_update_rate_reset(bfqd, NULL);
        bfqd->last_completion = now_ns;
-       bfqd->last_completed_rq_bfqq = bfqq;
+       /*
+        * Shared queues are likely to receive I/O at a high
+        * rate. This may deceptively let them be considered as wakers
+        * of other queues. But a false waker will unjustly steal
+        * bandwidth to its supposedly woken queue. So considering
+        * also shared queues in the waking mechanism may cause more
+        * control troubles than throughput benefits. Then do not set
+        * last_completed_rq_bfqq to bfqq if bfqq is a shared queue.
+        */
+       if (!bfq_bfqq_coop(bfqq))
+               bfqd->last_completed_rq_bfqq = bfqq;
 
        /*
         * If we are waiting to discover whether the request pattern