From patchwork Wed Oct 26 09:28:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 9396463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D1DFE60236 for ; Wed, 26 Oct 2016 09:30:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D8A6291C4 for ; Wed, 26 Oct 2016 09:30:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81FF929960; Wed, 26 Oct 2016 09:30:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9329291C4 for ; Wed, 26 Oct 2016 09:30:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758311AbcJZJ3v (ORCPT ); Wed, 26 Oct 2016 05:29:51 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:36712 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757303AbcJZJ3K (ORCPT ); Wed, 26 Oct 2016 05:29:10 -0400 Received: by mail-wm0-f52.google.com with SMTP id b80so213517702wme.1 for ; Wed, 26 Oct 2016 02:28:28 -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=Jml/41JlhPwaNfG08fZsSn+BbTSqK/Sz7KYwHwnWMzs=; b=f+oYkCyrKPI0Wy58R2jOLy3q9/GZuctpw9SjPtvlNSLlN8SPbzVL57mcDtXapcEPdE lX71u9qjJfBVodBnRnPecaNzs8EicrXQCTikOsaClMnhT8LvAdXHK3exN9P+GUBk351k JaJd9tEsR0jMJG+FIGmfbuRwLetGfOaEHcx8w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Jml/41JlhPwaNfG08fZsSn+BbTSqK/Sz7KYwHwnWMzs=; b=bHA68ieAcZRyGWRKDf8fXXSydmFEs5xde7wt+Ck3KuFW2nTO9Ixeel6EUaQVXJcVdw HEukGyiD4r36RUnpy6d61UTqlK8hWMauhkGWWBsYkLp/rAT/6wHlXkES2pZPETRTQqn4 4suq6aRLtUbSKZBz2gOlZeYtLHGaQEVEwNd2lCWv/+Yx/qk7RTUCyI5ooLguqguhD3lW 745TzCY0PZRvw/r5QCR2XKhgmUTmatMaPJo/azTWthF7nKUG4EMmqtwFeUCTVXUTZaP2 LogBmcKnxBYT1qeoOcdiIVPul7mqKVmMqUXZHOxLM6nfuWU5sbsHs0VJw7Le1ZqZ5ZL2 K6ig== X-Gm-Message-State: ABUngveOYPcDPv08fz1nE1dyIdfh3ZlgT2vBmrD6PGbYWyiEGpRr5kL0DW6wZ+lkIt4/bB0a X-Received: by 10.194.189.198 with SMTP id gk6mr1257607wjc.167.1477474105775; Wed, 26 Oct 2016 02:28:25 -0700 (PDT) Received: from paolo-VirtualBox.mat.unimo.it (nb-valente.mat.unimo.it. [155.185.5.181]) by smtp.gmail.com with ESMTPSA id q134sm8529945wme.3.2016.10.26.02.28.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Oct 2016 02:28:24 -0700 (PDT) From: Paolo Valente To: Jens Axboe , Tejun Heo Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org, hare@suse.de, arnd@arndb.de, bart.vanassche@sandisk.com, grant.likely@secretlab.ca, jack@suse.cz, James.Bottomley@HansenPartnership.com, Paolo Valente , Arianna Avanzini Subject: [PATCH 08/14] block, bfq: preserve a low latency also with NCQ-capable drives Date: Wed, 26 Oct 2016 11:28:01 +0200 Message-Id: <1477474082-2846-9-git-send-email-paolo.valente@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477474082-2846-1-git-send-email-paolo.valente@linaro.org> References: <1477474082-2846-1-git-send-email-paolo.valente@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP I/O schedulers typically allow NCQ-capable drives to prefetch I/O requests, as NCQ boosts the throughput exactly by prefetching and internally reordering requests. Unfortunately, as discussed in detail and shown experimentally in [1], this may cause fairness and latency guarantees to be violated. The main problem is that the internal scheduler of an NCQ-capable drive may postpone the service of some unlucky (prefetched) requests as long as it deems serving other requests more appropriate to boost the throughput. This patch addresses this issue by not disabling device idling for weight-raised queues, even if the device supports NCQ. This allows BFQ to start serving a new queue, and therefore allows the drive to prefetch new requests, only after the idling timeout expires. At that time, all the outstanding requests of the expired queue have been most certainly served. [1] P. Valente and M. Andreolini, "Improving Application Responsiveness with the BFQ Disk I/O Scheduler", Proceedings of the 5th Annual International Systems and Storage Conference (SYSTOR '12), June 2012. Slightly extended version: http://algogroup.unimore.it/people/paolo/disk_sched/bfq-v1-suite- results.pdf Signed-off-by: Paolo Valente Signed-off-by: Arianna Avanzini --- block/bfq-iosched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index d9b0900..3b11772 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -5746,7 +5746,8 @@ static void bfq_update_idle_window(struct bfq_data *bfqd, if (atomic_read(&bic->icq.ioc->active_ref) == 0 || bfqd->bfq_slice_idle == 0 || - (bfqd->hw_tag && BFQQ_SEEKY(bfqq))) + (bfqd->hw_tag && BFQQ_SEEKY(bfqq) && + bfqq->wr_coeff == 1)) enable_idle = 0; else if (bfq_sample_valid(bic->ttime.ttime_samples)) { if (bic->ttime.ttime_mean > bfqd->bfq_slice_idle &&