]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.51/block-bfq-increase-idling-for-weight-raised-queues.patch
Linux 4.19.51
[thirdparty/kernel/stable-queue.git] / releases / 4.19.51 / block-bfq-increase-idling-for-weight-raised-queues.patch
1 From b96ccad0ca65c47bfc56df7de2f8fbdf90fff3e7 Mon Sep 17 00:00:00 2001
2 From: Paolo Valente <paolo.valente@linaro.org>
3 Date: Tue, 12 Mar 2019 09:59:27 +0100
4 Subject: block, bfq: increase idling for weight-raised queues
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 [ Upstream commit 778c02a236a8728bb992de10ed1f12c0be5b7b0e ]
10
11 If a sync bfq_queue has a higher weight than some other queue, and
12 remains temporarily empty while in service, then, to preserve the
13 bandwidth share of the queue, it is necessary to plug I/O dispatching
14 until a new request arrives for the queue. In addition, a timeout
15 needs to be set, to avoid waiting for ever if the process associated
16 with the queue has actually finished its I/O.
17
18 Even with the above timeout, the device is however not fed with new
19 I/O for a while, if the process has finished its I/O. If this happens
20 often, then throughput drops and latencies grow. For this reason, the
21 timeout is kept rather low: 8 ms is the current default.
22
23 Unfortunately, such a low value may cause, on the opposite end, a
24 violation of bandwidth guarantees for a process that happens to issue
25 new I/O too late. The higher the system load, the higher the
26 probability that this happens to some process. This is a problem in
27 scenarios where service guarantees matter more than throughput. One
28 important case are weight-raised queues, which need to be granted a
29 very high fraction of the bandwidth.
30
31 To address this issue, this commit lower-bounds the plugging timeout
32 for weight-raised queues to 20 ms. This simple change provides
33 relevant benefits. For example, on a PLEXTOR PX-256M5S, with which
34 gnome-terminal starts in 0.6 seconds if there is no other I/O in
35 progress, the same applications starts in
36 - 0.8 seconds, instead of 1.2 seconds, if ten files are being read
37 sequentially in parallel
38 - 1 second, instead of 2 seconds, if, in parallel, five files are
39 being read sequentially, and five more files are being written
40 sequentially
41
42 Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
43 Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
44 Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
45 Signed-off-by: Jens Axboe <axboe@kernel.dk>
46 Signed-off-by: Sasha Levin <sashal@kernel.org>
47 ---
48 block/bfq-iosched.c | 2 ++
49 1 file changed, 2 insertions(+)
50
51 diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
52 index 15e8c9955b79..6bb397995610 100644
53 --- a/block/bfq-iosched.c
54 +++ b/block/bfq-iosched.c
55 @@ -2509,6 +2509,8 @@ static void bfq_arm_slice_timer(struct bfq_data *bfqd)
56 if (BFQQ_SEEKY(bfqq) && bfqq->wr_coeff == 1 &&
57 bfq_symmetric_scenario(bfqd))
58 sl = min_t(u64, sl, BFQ_MIN_TT);
59 + else if (bfqq->wr_coeff > 1)
60 + sl = max_t(u32, sl, 20ULL * NSEC_PER_MSEC);
61
62 bfqd->last_idling_start = ktime_get();
63 hrtimer_start(&bfqd->idle_slice_timer, ns_to_ktime(sl),
64 --
65 2.20.1
66