Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4523878imu; Tue, 29 Jan 2019 03:08:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN445bWzjL3EDKdGU3rV/qXkqPUVjBUaJXCgFXfNEglboj8D51fU7Rht2yTZB6iXR7Mt+aY+ X-Received: by 2002:a17:902:848d:: with SMTP id c13mr25753432plo.257.1548760092741; Tue, 29 Jan 2019 03:08:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548760092; cv=none; d=google.com; s=arc-20160816; b=a26J+iF+ldVyGmZk6OTkFlcZf+NQi1XZhYH2ciMI/ILaDbFcEp3rod6rPHcRj+pt6M kYtm+w60sATl0SJ/l93gGHZSj7kJqjz4x3eB+LgchB6vv9MF4X7jshxYMRCO6gjr001m vZhW2+7ECrDzTy+BjcgsOAvvte53HGRJuFGSIW/BTnR6PfTyyyeaSEqKFp66/QY/aaf2 jky6793NhnqEL+Df1yTcCFZe0EjOdUdlcSoQ1PzlmgGs4CMQlCJ268R4kFcuzb+ZmxYz RaTZRYIW6OvhMdNhGHjtGzxixTf4Z49oEo8Xfzx2lafSpD+JgIbgDqe6UrYGg/uAP9Bs xO/A== 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 r137si7841792pgr.395.2019.01.29.03.07.57; Tue, 29 Jan 2019 03:08:12 -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 S1728650AbfA2LH3 (ORCPT + 99 others); Tue, 29 Jan 2019 06:07:29 -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 Content-Transfer-Encoding: 8bit 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(+) 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; -- 2.20.1