From patchwork Tue Jan 29 11:06:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 156960 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4522625jaa; Tue, 29 Jan 2019 03:07:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Mgla1OKXb9U9yYX66KwyEYg/8J65OD1FIB/q1F0U/42+KOGWsAYtT+oonUm3mMNhm/Jge X-Received: by 2002:a62:f247:: with SMTP id y7mr25773047pfl.25.1548760034703; Tue, 29 Jan 2019 03:07:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548760034; cv=none; d=google.com; s=arc-20160816; b=H6hp0rOoMLjLNmSRNdrAZbGRIiyyQxGj2ZCRfIK7tKr42I9fUuAewBk9WWPJYoppgI dF584yowOpIQE3Qvp1iACfnMAzsbgLIBOeE05FvNsx+kFmYnKxLKWOTvAnOOwr7DdDlp WFfZTA7DK8SublBpTLAA0TxXh4RIPJJTT98I4QSM9sNjQev7KLDMgykZYhcQAeTaTTkF TgQDlDu818dpg7amZf+12K8xXaAXYb44Qp0aMGkDWGeroIbherA5GA5oNoNplBEaUizh QXJ+ZY4IwArZutCr+8kq5m2n3FgXKzCj+rJiTYaV1ZUQjEopQfahIlQOi0i/kp4qd6lj bgmw== 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=VwIs+zonmjtiCZ1USOo/5sS6ODQShYjtQFUwoinOfyA=; b=M2inLxHKb7sT/vCoySNoQ2NihUB10KakMp9UKjK8dF4f403jNep+mZHtjiZdr1VcS5 9mZtXyBk5QJ9ItHe6lXO7u62Ln9YIaEr7QRju3o7x8fDe69IoVM2JTE/AfGezwJHYXlw en6PvTogX/W4w8HJeHpSRAWzO6L5CNQDsERNDd/vwbSKSEGG9jiRbN/JkbU0wTt6Q9Bc QQ6TOdaT8c8yGFU/sBFDOYrGho4/FXZoxZzw0N4ZFIGvwtrpz+cb3Zbr8mD7oAVB2pY/ 4kGDM9NRIT65LB2EJ10sNJgSNooADOrRDCdxU11FgOr1lkIqIBvpg+dC1uPgMnPqmCHK dVjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dzNNNTGG; 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 j10si34363595pll.179.2019.01.29.03.07.14; Tue, 29 Jan 2019 03:07:14 -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=dzNNNTGG; 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 S1728590AbfA2LHN (ORCPT + 31 others); Tue, 29 Jan 2019 06:07:13 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39544 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728512AbfA2LHK (ORCPT ); Tue, 29 Jan 2019 06:07:10 -0500 Received: by mail-wr1-f65.google.com with SMTP id t27so21538420wra.6 for ; Tue, 29 Jan 2019 03:07:09 -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=VwIs+zonmjtiCZ1USOo/5sS6ODQShYjtQFUwoinOfyA=; b=dzNNNTGG5PdbsAoIUTXnKMvPIzXU2GiE2VkYxsWTf2UiyCY0wriVi0q9foVNjfoQol P/FaGtCg2bXNR6bff01uCTbsm3htu93+aSrkN86YiYT7JF4IpxTl1xTYqfozHHkmz1rD xO5QtpvJKdv15+MIghqrBcKbEoaxfmx0cjXzM= 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=VwIs+zonmjtiCZ1USOo/5sS6ODQShYjtQFUwoinOfyA=; b=t4Rl6UXFSUUT8/V1n6TcO3XdPIuFs4/NnyatPk1o4PboOGF7z4+It5YWwxBoZGy0or gIRDdlMRBJG5IfSHVGo3f97DYO2sbA8P+PG2kNiaMynwle0IRc9eXEo99iucdf+5oEtI B6Q8suEKSC/cDJrsyjdUeM2xUulMp8HvmfTIvTHVPBISqpbFsaTFwlsTLFAmQy2eTzf8 XtGO4TbSxGwLFxSLPJc4AnA5w3wvKE2mpPFLKqNTxKKGaW5ZX3BqPJRH7vEtPs2Vom6c HLFvpMZjd1dAnTJ9jVkGEcJPrJy8FkxcjKZeMJaNhfiwpSd8ltqra7mzfBkooIiLDTlq HrnQ== X-Gm-Message-State: AJcUukcJRHF05aQ71eq/1qJtaz9h7Xq4aNXnqwpIIdYIsaAaR0BMBSkh 7+SAka6VI+DRznBJRoOERBWziA== X-Received: by 2002:adf:f3c6:: with SMTP id g6mr21053279wrp.111.1548760028824; Tue, 29 Jan 2019 03:07:08 -0800 (PST) Received: from localhost.localdomain ([88.147.67.218]) by smtp.gmail.com with ESMTPSA id s132sm2066112wmf.28.2019.01.29.03.07.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 03:07:08 -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, mancha@tower-research.com, Paolo Valente Subject: [PATCH BUGFIX IMPROVEMENT 09/14] block, bfq: fix sequential rq detection in rate estimation Date: Tue, 29 Jan 2019 12:06:33 +0100 Message-Id: <20190129110638.12652-10-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190129110638.12652-1-paolo.valente@linaro.org> References: <20190129110638.12652-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 In bfq_update_peak_rate, to check whether an I/O request rq is sequential, only the seek distance of rq w.r.t. the last request dispatched is controlled. This is not sufficient for non-rotational storage, where the size of rq is at least as relevant. This commit adds the missing control. Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) -- 2.20.1 diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index c1bb5e5fcdc4..12228af16198 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -235,6 +235,11 @@ static struct kmem_cache *bfq_pool; #define BFQQ_SEEK_THR (sector_t)(8 * 100) #define BFQQ_SECT_THR_NONROT (sector_t)(2 * 32) +#define BFQ_RQ_SEEKY(bfqd, last_pos, rq) \ + (get_sdist(last_pos, rq) > \ + BFQQ_SEEK_THR && \ + (!blk_queue_nonrot(bfqd->queue) || \ + blk_rq_sectors(rq) < BFQQ_SECT_THR_NONROT)) #define BFQQ_CLOSE_THR (sector_t)(8 * 1024) #define BFQQ_SEEKY(bfqq) (hweight32(bfqq->seek_history) > 19) @@ -2754,7 +2759,7 @@ static void bfq_update_peak_rate(struct bfq_data *bfqd, struct request *rq) if ((bfqd->rq_in_driver > 0 || now_ns - bfqd->last_completion < BFQ_MIN_TT) - && get_sdist(bfqd->last_position, rq) < BFQQ_SEEK_THR) + && !BFQ_RQ_SEEKY(bfqd, bfqd->last_position, rq)) bfqd->sequential_samples++; bfqd->tot_sectors_dispatched += blk_rq_sectors(rq); @@ -4511,10 +4516,7 @@ bfq_update_io_seektime(struct bfq_data *bfqd, struct bfq_queue *bfqq, struct request *rq) { bfqq->seek_history <<= 1; - bfqq->seek_history |= - get_sdist(bfqq->last_request_pos, rq) > BFQQ_SEEK_THR && - (!blk_queue_nonrot(bfqd->queue) || - blk_rq_sectors(rq) < BFQQ_SECT_THR_NONROT); + bfqq->seek_history |= BFQ_RQ_SEEKY(bfqd, bfqq->last_request_pos, rq); } static void bfq_update_has_short_ttime(struct bfq_data *bfqd,