From patchwork Fri Aug 4 05:35:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 109371 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp1710553qge; Thu, 3 Aug 2017 22:35:39 -0700 (PDT) X-Received: by 10.99.65.196 with SMTP id o187mr1107009pga.193.1501824939583; Thu, 03 Aug 2017 22:35:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501824939; cv=none; d=google.com; s=arc-20160816; b=HYjDBOfHk1e93S6+JQwgFKv36FTomroGNwqSLCvCigRtqX8GJJHapr8Fd4hvQ5GrYB LV7xZDCb5gr2Mrae2dYn5pajR8190+cODi+hfrrX1BFunnqGeCu5RH2pBd6550unLbf3 IuJu5gQYSeDfs4tefVfOQoGM28xI86LO15nb6EQQugkT8E+ARcyApNf2UwAjWW4HvUd4 XmGj3L79NiguqA2DbJFCW5TlLmDbHzapg4GLffUVrtK6F59FX8BR7/jbmgwa2oSk4yCp heW9ZvQqBtalYOrvFo7oMHy6fMhVDJ7TAtPbpGUCYuBu8Cy1LnaL2TFFxyn9dVMnadqX KHhg== 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=CIRX8Y9MElfdXj5FRrqnkXLtIJPsU+MC4PYFAK8m4tc=; b=VyCctfLSdYDxns7yE9N6/ATs6RVCUd0rW/Kgh/yqhtEYOeQvnOZvkxZ+hmEBTYgQLf NyLHapVPSsWypnOIXVBQzS2ZndpO04ZFnvYi2e/FrSoObEu7nbT9YzeFMdecfEpO5FS1 P1mGxckgI6J53ro23F4fTgstGh9J6dgid1a5k7nuSvHeMYUeVUVQunTvvMJSOJv4OPyQ jrMvrftDAcESHV7zrCj+F169aiQusIrb1t4po8g8cmKuVpv/07ac5bPsSPWuJABBwkKr 62aqlJlEcrhkkGhbh59vdKxkoJeSFZfJoIjPj/vic/JAWN6swGxnbm1UbrKf9fImc8dW nu0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=CYw9TBxA; 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 u3si552657plm.527.2017.08.03.22.35.39; Thu, 03 Aug 2017 22:35:39 -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.b=CYw9TBxA; 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 S1751484AbdHDFfc (ORCPT + 25 others); Fri, 4 Aug 2017 01:35:32 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:38200 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751321AbdHDFf3 (ORCPT ); Fri, 4 Aug 2017 01:35:29 -0400 Received: by mail-wm0-f42.google.com with SMTP id m85so11044256wma.1 for ; Thu, 03 Aug 2017 22:35:29 -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=CIRX8Y9MElfdXj5FRrqnkXLtIJPsU+MC4PYFAK8m4tc=; b=CYw9TBxAY6RA4b76kYjwVaNYFukBImYStCoS0V6J1NsfD0+ehVRqKAwBQCTb8bh3R7 B3hHqGcfRRjHcX/+SUm8t5w6JTvhz6JZ+sFHLSJ9aR1EVOdIeyOtNdhIN2T2aeG1Prqv GDQeHDv33LToIeUdUJiK803M38fLyjc7DUPHQ= 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=CIRX8Y9MElfdXj5FRrqnkXLtIJPsU+MC4PYFAK8m4tc=; b=ECP04jr9wlej3rWZH3LIxjGcAw/jhbSyXz4kAdEKNm3yti1VUICVnMruIB0NQS0AEx xqZREKETCXSHQBqTAXvW1ki2BZ09R9mGkc/tXg6toTIUtjiR/VqPM0fdK/u1wwls5Oaw Q93YVNGGSdPFRlrsIYEggcQJzyFsvtE5pXWWMcoVkWCpN5Ug43W3LVRdwRTmq24hjp+d qfKitIMcf8wzVvkeW4otchH0GWtQ6vWAFjgwJn88+H+6662wpujWh9G3g2EM62Nl1nt+ nTig3BpF+YAoYfMAwoAMGOOhk3gM/iwnAff8VpDxMGd7yWUr7fqXIR2dL/ngHluxymn9 0g0A== X-Gm-Message-State: AHYfb5jGvU54/48ZToaqrAI9I6rD4t0Qpmul2fR8WzIQUF69psBNz6Hw PjAyqdigypA3M1Zn X-Received: by 10.28.170.18 with SMTP id t18mr512304wme.6.1501824928496; Thu, 03 Aug 2017 22:35:28 -0700 (PDT) Received: from localhost.localdomain ([185.14.11.62]) by smtp.gmail.com with ESMTPSA id 196sm3082142wmg.36.2017.08.03.22.35.26 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 03 Aug 2017 22:35:27 -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, lucmiccio@gmail.com, Paolo Valente Subject: [PATCH BUGFIX/IMPROVEMENT V2 2/2] block, bfq: boost throughput with flash-based non-queueing devices Date: Fri, 4 Aug 2017 07:35:11 +0200 Message-Id: <20170804053511.2389-3-paolo.valente@linaro.org> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20170804053511.2389-1-paolo.valente@linaro.org> References: <20170804053511.2389-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a queue associated with a process remains empty, there are cases where throughput gets boosted if the device is idled to await the arrival of a new I/O request for that queue. Currently, BFQ assumes that one of these cases is when the device has no internal queueing (regardless of the properties of the I/O being served). Unfortunately, this condition has proved to be too general. So, this commit refines it as "the device has no internal queueing and is rotational". This refinement provides a significant throughput boost with random I/O, on flash-based storage without internal queueing. For example, on a HiKey board, throughput increases by up to 125%, growing, e.g., from 6.9MB/s to 15.6MB/s with two or three random readers in parallel. Signed-off-by: Paolo Valente Signed-off-by: Luca Miccio --- block/bfq-iosched.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) -- 2.10.0 diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index ccdc9e6..509f399 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -3114,7 +3114,10 @@ static bool bfq_may_expire_for_budg_timeout(struct bfq_queue *bfqq) static bool bfq_bfqq_may_idle(struct bfq_queue *bfqq) { struct bfq_data *bfqd = bfqq->bfqd; - bool idling_boosts_thr, idling_boosts_thr_without_issues, + bool rot_without_queueing = + !blk_queue_nonrot(bfqd->queue) && !bfqd->hw_tag, + bfqq_sequential_and_IO_bound, + idling_boosts_thr, idling_boosts_thr_without_issues, idling_needed_for_service_guarantees, asymmetric_scenario; @@ -3133,28 +3136,34 @@ static bool bfq_bfqq_may_idle(struct bfq_queue *bfqq) bfq_class_idle(bfqq)) return false; + bfqq_sequential_and_IO_bound = !BFQQ_SEEKY(bfqq) && + bfq_bfqq_IO_bound(bfqq) && bfq_bfqq_has_short_ttime(bfqq); + /* * The next variable takes into account the cases where idling * boosts the throughput. * * The value of the variable is computed considering, first, that * idling is virtually always beneficial for the throughput if: - * (a) the device is not NCQ-capable, or - * (b) regardless of the presence of NCQ, the device is rotational - * and the request pattern for bfqq is I/O-bound and sequential. + * (a) the device is not NCQ-capable and rotational, or + * (b) regardless of the presence of NCQ, the device is rotational and + * the request pattern for bfqq is I/O-bound and sequential, or + * (c) regardless of whether it is rotational, the device is + * not NCQ-capable and the request pattern for bfqq is + * I/O-bound and sequential. * * Secondly, and in contrast to the above item (b), idling an * NCQ-capable flash-based device would not boost the * throughput even with sequential I/O; rather it would lower * the throughput in proportion to how fast the device * is. Accordingly, the next variable is true if any of the - * above conditions (a) and (b) is true, and, in particular, - * happens to be false if bfqd is an NCQ-capable flash-based - * device. + * above conditions (a), (b) or (c) is true, and, in + * particular, happens to be false if bfqd is an NCQ-capable + * flash-based device. */ - idling_boosts_thr = !bfqd->hw_tag || - (!blk_queue_nonrot(bfqd->queue) && bfq_bfqq_IO_bound(bfqq) && - bfq_bfqq_has_short_ttime(bfqq)); + idling_boosts_thr = rot_without_queueing || + ((!blk_queue_nonrot(bfqd->queue) || !bfqd->hw_tag) && + bfqq_sequential_and_IO_bound); /* * The value of the next variable,