]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
blok, bfq: do not plug I/O if all queues are weight-raised
authorPaolo Valente <paolo.valente@linaro.org>
Fri, 14 Sep 2018 14:23:09 +0000 (16:23 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 26 Nov 2019 12:16:37 +0000 (13:16 +0100)
BugLink: https://bugs.launchpad.net/bugs/1853915
[ Upstream commit c8765de0adfcaaf4ffb2d951e07444f00ffa9453 ]

To reduce latency for interactive and soft real-time applications, bfq
privileges the bfq_queues containing the I/O of these
applications. These privileged queues, referred-to as weight-raised
queues, get a much higher share of the device throughput
w.r.t. non-privileged queues. To preserve this higher share, the I/O
of any non-weight-raised queue must be plugged whenever a sync
weight-raised queue, while being served, remains temporarily empty. To
attain this goal, bfq simply plugs any I/O (from any queue), if a sync
weight-raised queue remains empty while in service.

Unfortunately, this plugging typically lowers throughput with random
I/O, on devices with internal queueing (because it reduces the filling
level of the internal queues of the device).

This commit addresses this issue by restricting the cases where
plugging is performed: if a sync weight-raised queue remains empty
while in service, then I/O plugging is performed only if some of the
active bfq_queues are *not* weight-raised (which is actually the only
circumstance where plugging is needed to preserve the higher share of
the throughput of weight-raised queues). This restriction proved able
to boost throughput in really many use cases needing only maximum
throughput.

Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
block/bfq-iosched.c

index 97c5831fcf82e94e010dab96045260f785395205..5db386c2dd52b68ad1f8dd039e012515951704e0 100644 (file)
@@ -3344,7 +3344,12 @@ static bool bfq_bfqq_may_idle(struct bfq_queue *bfqq)
         * whether bfqq is being weight-raised, because
         * bfq_symmetric_scenario() does not take into account also
         * weight-raised queues (see comments on
-        * bfq_weights_tree_add()).
+        * bfq_weights_tree_add()). In particular, if bfqq is being
+        * weight-raised, it is important to idle only if there are
+        * other, non-weight-raised queues that may steal throughput
+        * to bfqq. Actually, we should be even more precise, and
+        * differentiate between interactive weight raising and
+        * soft real-time weight raising.
         *
         * As a side note, it is worth considering that the above
         * device-idling countermeasures may however fail in the
@@ -3356,7 +3361,8 @@ static bool bfq_bfqq_may_idle(struct bfq_queue *bfqq)
         * to let requests be served in the desired order until all
         * the requests already queued in the device have been served.
         */
-       asymmetric_scenario = bfqq->wr_coeff > 1 ||
+       asymmetric_scenario = (bfqq->wr_coeff > 1 &&
+                              bfqd->wr_busy_queues < bfqd->busy_queues) ||
                !bfq_symmetric_scenario(bfqd);
 
        /*