From patchwork Tue Jan 29 11:06:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 156964 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4522940jaa; Tue, 29 Jan 2019 03:07:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN7dWn5B/te5qcYx3364WBX/F+3J32WxNOMgqxyyypx9+y8CjMFPbtknxOp3PGlB7m8zyz0n X-Received: by 2002:a63:b0a:: with SMTP id 10mr23373169pgl.423.1548760052468; Tue, 29 Jan 2019 03:07:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548760052; cv=none; d=google.com; s=arc-20160816; b=C8zUmfZE3TuGYPRGlvznCMsqA1sVgIjhJmf3MmDMwYrrFr+A8uYjddB2iunw9aZRAo QT/UZfILEC9XJoZKraUQc7JcSGuSiHNYGZ2EraKMvDwlXxpH1qvsK4xBxo4Ub8IG888E ATmdIEfTTIad3Dn50QEQMNbiouVUMS9LjVNBVcGAlKjqIXJpKJH6sR+l5kFQDt43U3Qu 55Zb9jOsy2slx/8vYJiJ798yN1CnKaqpgbKD2/EFf2ZSP/JmLoaCCJhQA6FO2sfATtS+ sjCNkiFmSCpOjhrOqLpDlLfOtH48XD3yqjqDC/5L05NyaP6mGlrI18fpZJQBaUcGhZVd z/0A== 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=xDzJdQaJUVbOMOgsobVLGeLVo1CynjuO1LWZuQEuQ0s=; b=MmzmfudJU4Q1pn7XSJ3gM5T5rqdibPhEGJXzYofFOLBWzF4NAtB7cFRwyPI+zFh4ic ej/15SXNgX90uLEA45aQpkAfae3/X1QVfBnwqt963VYY3aBikuzmwYfi7nCggpqnJQKX v3s4N47F0w+XFIfFGIAQLxY8BQ1MC/ikKzT/nV4p2MrFvvF3CUToyQtoCOBuGwxRyIOM 6us3UpGtggUBROrIyFz4nYp/OwXXnF0eJxxGGoGHjK7dag3jPGfGKGqqdTXqXRBBsJi+ Aigw2BbQwRBDZsAUyw8RXmq5G0TJgQY9D3nXabIATb+ZS37byRhHMozSv0q/C0NyNVnb USEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YlNrCME0; 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 j132si35082951pfc.84.2019.01.29.03.07.32; Tue, 29 Jan 2019 03:07:32 -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=YlNrCME0; 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 S1728654AbfA2LHa (ORCPT + 31 others); Tue, 29 Jan 2019 06:07:30 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33491 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728594AbfA2LHO (ORCPT ); Tue, 29 Jan 2019 06:07:14 -0500 Received: by mail-wr1-f65.google.com with SMTP id p7so21606788wru.0 for ; Tue, 29 Jan 2019 03:07: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=xDzJdQaJUVbOMOgsobVLGeLVo1CynjuO1LWZuQEuQ0s=; b=YlNrCME02AvhfJTfFzDA7cXLW6GkN4P602kH9FqZdMo8dfqIjrdqLc0SZVieJXCoRk EjdcaZrCdjJRqKoBG9NcdFH+dOguGYF0kGl4fWzV9VPBr3jVZNgBhaVc8Z87DiCt5APe jwOLIrtW+c8AGnIapiBil70XxXFnbCiHytrkY= 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=xDzJdQaJUVbOMOgsobVLGeLVo1CynjuO1LWZuQEuQ0s=; b=UzCx4KUe0UytLqhjroHrLilW3Hx234XFV5oVNNQSFh01jkHx+YD6stbDpXpyU0VuNa a8wNbeFsQBRGj+6GBKeLTVAOXT1PNDyErbGLXRS8cNC4ambQNCcgreE1OR5XAJvv3YJw 7x9bFdBVV1Hw1BmCQ/ljfIc9gbyGDb1YdgViGTiOaF+tlPnOOAFG1/Ju+XnDny+Cc4Ox Zs3ngq+lHoj3Popdx8De/7RgTXyiZBomxmfdrpBPonSvLldIvAoIPUCfE+pAmJ/KPo2R t8LjzsHydDyG/aeLka7nZt2RW56Ix0MXxEkZ7CCP6au23//87DBB9a681V2IETr/zSt+ FMmw== X-Gm-Message-State: AJcUukfvzXgq5XX750AockvLWJ5hTzeTKHbjP5w08CTRnh1Tc4Cf7oto 6pGy8EoiUDWr9EuzzOspE1Xo7w== X-Received: by 2002:adf:c711:: with SMTP id k17mr24732765wrg.197.1548760032900; Tue, 29 Jan 2019 03:07:12 -0800 (PST) Received: from localhost.localdomain ([88.147.67.218]) by smtp.gmail.com with ESMTPSA id s132sm2066112wmf.28.2019.01.29.03.07.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 03:07:12 -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 12/14] block, bfq: port commit "cfq-iosched: improve hw_tag detection" Date: Tue, 29 Jan 2019 12:06:36 +0100 Message-Id: <20190129110638.12652-13-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 The original commit is commit 1a1238a7dd48 ("cfq-iosched: improve hw_tag detection") and has the following commit message. If active queue hasn't enough requests and idle window opens, cfq will not dispatch sufficient requests to hardware. In such situation, current code will zero hw_tag. But this is because cfq doesn't dispatch enough requests instead of hardware queue doesn't work. Don't zero hw_tag in such case. Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.20.1 diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 48b579032d14..2ab53d93ba12 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -4786,6 +4786,8 @@ static void bfq_insert_requests(struct blk_mq_hw_ctx *hctx, static void bfq_update_hw_tag(struct bfq_data *bfqd) { + struct bfq_queue *bfqq = bfqd->in_service_queue; + bfqd->max_rq_in_driver = max_t(int, bfqd->max_rq_in_driver, bfqd->rq_in_driver); @@ -4801,6 +4803,17 @@ static void bfq_update_hw_tag(struct bfq_data *bfqd) if (bfqd->rq_in_driver + bfqd->queued <= BFQ_HW_QUEUE_THRESHOLD) return; + /* + * If active queue hasn't enough requests and can idle, bfq might not + * dispatch sufficient requests to hardware. Don't zero hw_tag in this + * case + */ + if (bfqq && bfq_bfqq_has_short_ttime(bfqq) && + bfqq->dispatched + bfqq->queued[0] + bfqq->queued[1] < + BFQ_HW_QUEUE_THRESHOLD && + bfqd->rq_in_driver < BFQ_HW_QUEUE_THRESHOLD) + return; + if (bfqd->hw_tag_samples++ < BFQ_HW_QUEUE_SAMPLES) return;