From patchwork Thu May 31 14:45:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 137419 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp6691927lji; Thu, 31 May 2018 07:46:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJHsZxqxF9knc1NpoS+Mifdwjws92qBETJAY6px+3Lj8JSeI6WT+Gp1289uHeOpNcs3DWRk X-Received: by 2002:a17:902:1a6:: with SMTP id b35-v6mr7257734plb.80.1527777966579; Thu, 31 May 2018 07:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527777966; cv=none; d=google.com; s=arc-20160816; b=ek4aXw/mUeLPN2gGqzMZ4CMesF1/mNXvlEEL4QBZ1iqGnjgLzhhUEF5LSAQ9iF2oaR BmXjb2UgqGJpdMq/3IlT2r9JyPVUBKq71lynVhJ1wFOPfm7f3Tp1eF7HAh9vYGwlsQw+ xD0ktm4StLpR8EHxYZVevuDrtfTG8/gj/MDLq+RseF5qjw8qlOo3xDAWdpY+AKYupIHv xAdaqYGoytY239TKKsUFu5S937Tx4flAZau5FK6uSWeU7uBARfcP2NfDz4KQTWutOZNz cgmwIaQoJBU4b1LRJeLmTPz8HQ4i/uZpIydWvZcvhlDv9beIDq70hxfxKKeWfOn3PRdi 39Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=OXEYZyoVidrAtqd+nqmbdenmsTMXMPcHkxKsAlNM+es=; b=HDc7wNSFyf/VMG2rbzcPDTQ1mIyORpuh7MZGIyxWV1oZIQMENg7Yk3JWR69v7JwSIO M49i9dPZH+HInjdfNTQqGqlGVVk4lr/Xwokv3gKDbSV+AHZqG5T4S5xWdcM5LDIKed81 gnzqc0EWko/2YWu8pq5ooyiLVZuQTOV3Lwf1D+gKOsUg+PekUA2q4nX0iWTRLOi9PzqS bOtSRe2K18HTW4MZnizayJxxEC2D7CBDylyrPfBbp0vjBajvxzMVNNivL9UBigLd/+E3 5D8BbtwlJ9qSS9fePadT71wGsfbxwjYHMR1KcWmfhZWUz9Rcd4vnSwp35xhdgO2p4HOV feWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TDFC/ifE; 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 p91-v6si37495154plb.457.2018.05.31.07.46.06; Thu, 31 May 2018 07:46:06 -0700 (PDT) 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=TDFC/ifE; 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 S1755489AbeEaOqD (ORCPT + 30 others); Thu, 31 May 2018 10:46:03 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:51116 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755441AbeEaOpd (ORCPT ); Thu, 31 May 2018 10:45:33 -0400 Received: by mail-wm0-f67.google.com with SMTP id t11-v6so54546755wmt.0 for ; Thu, 31 May 2018 07:45:32 -0700 (PDT) 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; bh=OXEYZyoVidrAtqd+nqmbdenmsTMXMPcHkxKsAlNM+es=; b=TDFC/ifE1oOjwgDhQ/4FqouSeNpmLb3g3w8QvEnoOoOM1bJncROGT7nyBIPrlpDlEA i9xcVpfawyyPMv9P67qTyKWGnvQ1EeGI+ezX9ixXgRuXMyjRjvsGmRnMaK7UzEuWTO/z 71eIpPmdMI0bErfCsbK1Xoco/XMSFRFGkJBMY= 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; bh=OXEYZyoVidrAtqd+nqmbdenmsTMXMPcHkxKsAlNM+es=; b=BaPO7Djm2yfsGjuT9JRuZOAP2lZbU5GelzB5aj1ouOT6d3MloLC0ZKpX+8Z1Te64Ml w4+BBflm43GlUCJa/Q+oJmoLqbDcfMf7HeFyiOTXr/8iyCc3DYIlAgM2Y6t7jD+tVBrL 7/KcX3Ih4GnVbfps1VV29QGDSh2A999wdHGEcr54TZ/KSOMpoh4L9SUkjHFD03tNwZif BM1n23fNOYzx+V4mqg2dFKeL542ikwpWjnec1TSIwLm2vZZpvb2euH3dbpsL9oMbsRzq iZ93dQVfyxTtkiodcDMp5pYJZae8CVCNDJTiVaonyE1c02qcbjuC+VQ7gGigj6HFvoRO Ha1A== X-Gm-Message-State: APt69E29HtqAXeDwfy1SiGUacfqUXEZhOnQ2jeq0oo0uMxfQrjObYUwg LgI9MFRjz+XZMLt5Rb9Pge4R/A== X-Received: by 2002:a1c:f70b:: with SMTP id v11-v6mr125621wmh.77.1527777931700; Thu, 31 May 2018 07:45:31 -0700 (PDT) Received: from localhost.localdomain (146-241-12-84.dyn.eolo.it. [146.241.12.84]) by smtp.gmail.com with ESMTPSA id y45-v6sm36106869wrd.97.2018.05.31.07.45.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 May 2018 07:45:30 -0700 (PDT) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, broonie@kernel.org, linus.walleij@linaro.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, sapienza.dav@gmail.com, 177992@studenti.unimore.it, Paolo Valente Subject: [PATCH BUGFIX/IMPROVEMENTS 3/4] block, bfq: increase weight-raising duration for interactive apps Date: Thu, 31 May 2018 16:45:07 +0200 Message-Id: <20180531144508.3927-4-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180531144508.3927-1-paolo.valente@linaro.org> References: <20180531144508.3927-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Davide Sapienza The maximum possible duration of the weight-raising period for interactive applications is limited to 13 seconds, as this is the time needed to load the largest application that we considered when tuning weight raising. Unfortunately, in such an evaluation, we did not consider the case of very slow virtual machines. For example, on a QEMU/KVM virtual machine - running in a slow PC; - with a virtual disk stacked on a slow low-end 5400rpm HDD; - serving a heavy I/O workload, such as the sequential reading of several files; mplayer takes 23 seconds to start, if constantly weight-raised. To address this issue, this commit conservatively sets the upper limit for weight-raising duration to 25 seconds. Signed-off-by: Davide Sapienza Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) -- 2.16.1 diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 262c929e24ee..31ce089d54eb 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -930,22 +930,26 @@ static unsigned int bfq_wr_duration(struct bfq_data *bfqd) do_div(dur, bfqd->peak_rate); /* - * Limit duration between 3 and 13 seconds. Tests show that - * higher values than 13 seconds often yield the opposite of - * the desired result, i.e., worsen responsiveness by letting - * non-interactive and non-soft-real-time applications - * preserve weight raising for a too long time interval. + * Limit duration between 3 and 25 seconds. The upper limit + * has been conservatively set after the following worst case: + * on a QEMU/KVM virtual machine + * - running in a slow PC + * - with a virtual disk stacked on a slow low-end 5400rpm HDD + * - serving a heavy I/O workload, such as the sequential reading + * of several files + * mplayer took 23 seconds to start, if constantly weight-raised. + * + * As for higher values than that accomodating the above bad + * scenario, tests show that higher values would often yield + * the opposite of the desired result, i.e., would worsen + * responsiveness by allowing non-interactive applications to + * preserve weight raising for too long. * * On the other end, lower values than 3 seconds make it * difficult for most interactive tasks to complete their jobs * before weight-raising finishes. */ - if (dur > msecs_to_jiffies(13000)) - dur = msecs_to_jiffies(13000); - else if (dur < msecs_to_jiffies(3000)) - dur = msecs_to_jiffies(3000); - - return dur; + return clamp_val(dur, msecs_to_jiffies(3000), msecs_to_jiffies(25000)); } /* switch back from soft real-time to interactive weight raising */