From patchwork Thu Mar 7 16:25:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 159881 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp7628343jad; Thu, 7 Mar 2019 08:26:20 -0800 (PST) X-Google-Smtp-Source: APXvYqzIG7IHYqkim4LtxVuWierdPjhd3dNX15HOTejdnbL3mGeVfwQogVTWpDo5BMmF59Gp3rGh X-Received: by 2002:a63:65c4:: with SMTP id z187mr4259263pgb.102.1551975980058; Thu, 07 Mar 2019 08:26:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551975980; cv=none; d=google.com; s=arc-20160816; b=AZn/eZShRhnNxwCBY67m2nmYP0YF+yJ6SDcXxYqdTxGNQAOfLa2HTlttyDFOfW3cnv pG6x69TsfNlfhhwY1mL8CGi5i+xnTi49MWB1jwIrPBLWnOlKSO+a9dzhbU3CxjeHLWlo lBxDW6lD6sblI9MpNJTbnEPVRc2ojAX0anNIoacLz7OuIMKVkMbvH0aS5dkLSxitlTXX 6KpUl15yeyWu3yaVAeE0wivzbhdz5UV0u6LKtZ1Swybqm5Ju8JwfV0ngDzIIGqsbp1EM wRs1Bs3JmRiQEKjpTv+SMezlTLY7W2h5H4fxZmOQT2/tl+6jNpmv0enfjb2U2w+Q2c79 Wneg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SY00KoFWeTwZXwxCAxRn3goBCIvGzbExPxId3YVmDAI=; b=nNjIsmShuyBNzwMud9kB2vnez2uIUKbR2hQekFhNCwtsUDkaIerjX+1e13lLPzL1Lz XmaPvVpHiFOTvYV8pFQZOrAaWzKrK+9cU6Ylxn+P3TaS1dPQ0lmzAwGZ7rJj5Ph2oAbY 1hWWK55aB6yB00eX4kfdLSkrw2JBwl2xcBjY2run8NUiujcjyq6V1+aIsLJukteIFNLl Fo+JzWWO5z1l3pPuggv94mIMy9RbOA5msuiwNn2fiNtCc9R88DVmCLgT7KOP7A1oBNYH DPtyK19qUTROjL18zHjysLGF98J4AsNRhisYlGj43ativ7lRZr2xEa678Voy7Y6Ypn87 h8YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z75T8hDp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l16si2039022pgg.459.2019.03.07.08.26.19; Thu, 07 Mar 2019 08:26:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z75T8hDp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726414AbfCGQ0R (ORCPT + 31 others); Thu, 7 Mar 2019 11:26:17 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:37128 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726275AbfCGQ0O (ORCPT ); Thu, 7 Mar 2019 11:26:14 -0500 Received: by mail-wm1-f68.google.com with SMTP id x10so9791189wmg.2 for ; Thu, 07 Mar 2019 08:26:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SY00KoFWeTwZXwxCAxRn3goBCIvGzbExPxId3YVmDAI=; b=Z75T8hDpDi1+Pm2Su4PJKBxlbasjZjnSzjQhz6b470S0GFTTqJjFMS5NDxj7nS8LFE EJI/QQEJkG9kYknYgewNVTSsJ/HWO7vg9FxArz4inYurRrFOqySHiTUyNqILlvVb30vi sTOvXKmbe/sKdF1RarTKbSacGJHh8/XkrV0pvDu9XQGVRkAlc5ZNLBS2Lpa8NjUjEt+k iKHuxgZcj/U26ihOAHhUWWoBwC2O6hr3ZclZUCeVrHLQXuU46Q2WUL/jnaFZysIyQ6xS /Zy1PPDhalZ499zka/rYiXT90YBa6BrMCDipljv/JTNym10GlCxj39gRoaNPamySrQpu DbgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SY00KoFWeTwZXwxCAxRn3goBCIvGzbExPxId3YVmDAI=; b=SHCqCulc5NZOQnOW9mz6AVldCM73f7b2g74gpUhKyNvUUh3Z6lWSay3e4+QhbkwdJD e0p4qcoWcBWJVsaJMoX9n0DcxsCF9sbSjGwQoDLbpLF+R8uc0NTPNUWTbKQILKra0Ojt 7ikIEFNn0ATdAgNEGuPIFniiMnbdljJrayHnsEaYDEuWV9kxZwzVyaKnnKKDRLW5zbXy XiLh90H3g9gC2jLNJ0T2nZW3NihXhvjqq6H+Ox8dtCiAaHjMBAcBjvoUGbWTgUletmKV tcfticbRIXw1OCNIhPVHVGezolH3KnpGi3bd2HOjGemGobFFwfc7d3gT3IlWokmEuQ7A AWHg== X-Gm-Message-State: APjAAAVMkquy0ezj7Q7FPCjjYK4bcNxBepsgbQZooZbUKs0mhGCMMtxV wPxxGdSBPfYkHvj8a+IBEmsgQw== X-Received: by 2002:a1c:9c0e:: with SMTP id f14mr6529463wme.78.1551975972267; Thu, 07 Mar 2019 08:26:12 -0800 (PST) Received: from localhost.localdomain (146-241-117-61.dyn.eolo.it. [146.241.117.61]) by smtp.gmail.com with ESMTPSA id o127sm5801797wmo.20.2019.03.07.08.26.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 08:26:11 -0800 (PST) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, fra.fra.800@gmail.com, Paolo Valente Subject: [PATCH BUGFIX IMPROVEMENT 1/8] block, bfq: increase idling for weight-raised queues Date: Thu, 7 Mar 2019 17:25:47 +0100 Message-Id: <20190307162554.77205-2-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190307162554.77205-1-paolo.valente@linaro.org> References: <20190307162554.77205-1-paolo.valente@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If a sync bfq_queue has a higher weight than some other queue, and remains temporarily empty while in service, then, to preserve the bandwidth share of the queue, it is necessary to plug I/O dispatching until a new request arrives for the queue. In addition, a timeout needs to be set, to avoid waiting for ever if the process associated with the queue has actually finished its I/O. Even with the above timeout, the device is however not fed with new I/O for a while, if the process has finished its I/O. If this happens often, then throughput drops and latencies grow. For this reason, the timeout is kept rather low: 8 ms is the current default. Unfortunately, such a low value may cause, on the opposite end, a violation of bandwidth guarantees for a process that happens to issue new I/O too late. The higher the system load, the higher the probability that this happens to some process. This is a problem in scenarios where service guarantees matter more than throughput. One important case are weight-raised queues, which need to be granted a very high fraction of the bandwidth. To address this issue, this commit lower-bounds the plugging timeout for weight-raised queues to 20 ms. This simple change provides relevant benefits. For example, on a PLEXTOR PX-256M5S, with which gnome-terminal starts in 0.6 seconds if there is no other I/O in progress, the same applications starts in - 0.8 seconds, instead of 1.2 seconds, if ten files are being read sequentially in parallel - 1 second, instead of 2 seconds, if, in parallel, five files are being read sequentially, and five more files are being written sequentially Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.20.1 diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 4c592496a16a..eb658de3cc40 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -2545,6 +2545,8 @@ static void bfq_arm_slice_timer(struct bfq_data *bfqd) if (BFQQ_SEEKY(bfqq) && bfqq->wr_coeff == 1 && bfq_symmetric_scenario(bfqd)) sl = min_t(u64, sl, BFQ_MIN_TT); + else if (bfqq->wr_coeff > 1) + sl = max_t(u32, sl, 20ULL * NSEC_PER_MSEC); bfqd->last_idling_start = ktime_get(); hrtimer_start(&bfqd->idle_slice_timer, ns_to_ktime(sl),