All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Jens Axboe <axboe@kernel.dk>
Cc: <linux-block@vger.kernel.org>,
	Paolo Valente <paolo.valente@linaro.org>, Jan Kara <jack@suse.cz>
Subject: [PATCH 3/3] bfq: Use only idle IO periods for think time calculations
Date: Wed, 13 Jan 2021 11:09:27 +0100	[thread overview]
Message-ID: <20210113100937.8278-3-jack@suse.cz> (raw)
In-Reply-To: <20200605140837.5394-1-jack@suse.cz>

Currently whenever bfq queue has a request queued we add now -
last_completion_time to the think time statistics. This is however
misleading in case the process is able to submit several requests in
parallel because e.g. if the queue has request completed at time T0 and
then queues new requests at times T1, T2, then we will add T1-T0 and
T2-T0 to think time statistics which just doesn't make any sence (the
queue's think time is penalized by the queue being able to submit more
IO). So add to think time statistics only time intervals when the queue
had no IO pending.

Acked-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 block/bfq-iosched.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index d0b744eae1a3..53e6e76b98af 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -5195,8 +5195,16 @@ static void bfq_update_io_thinktime(struct bfq_data *bfqd,
 				    struct bfq_queue *bfqq)
 {
 	struct bfq_ttime *ttime = &bfqq->ttime;
-	u64 elapsed = ktime_get_ns() - bfqq->ttime.last_end_request;
+	u64 elapsed;
 
+	/*
+	 * We are really interested in how long it takes for the queue to
+	 * become busy when there is no outstanding IO for this queue. So
+	 * ignore cases when the bfq queue has already IO queued.
+	 */
+	if (bfqq->dispatched || bfq_bfqq_busy(bfqq))
+		return;
+	elapsed = ktime_get_ns() - bfqq->ttime.last_end_request;
 	elapsed = min_t(u64, elapsed, 2ULL * bfqd->bfq_slice_idle);
 
 	ttime->ttime_samples = (7*ttime->ttime_samples + 256) / 8;
-- 
2.26.2


  parent reply	other threads:[~2021-01-13 10:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05 14:16 [PATCH 0/3] bfq: Two fixes and a cleanup for sequential readers Jan Kara
2021-01-13 10:09 ` [PATCH 0/3 v2] " Jan Kara
2020-06-05 14:16 ` [PATCH 1/3] bfq: Avoid false bfq queue merging Jan Kara
2020-06-11  7:13   ` Paolo Valente
2020-06-11  8:31     ` Jan Kara
2020-06-11 14:12       ` Paolo Valente
2021-01-10  9:21         ` Paolo Valente
2020-06-05 14:16 ` [PATCH 2/3] bfq: Use 'ttime' local variable Jan Kara
2020-06-11  7:14   ` Paolo Valente
2020-06-05 14:16 ` [PATCH 3/3] bfq: Use only idle IO periods for think time calculations Jan Kara
2020-06-11 14:11   ` Paolo Valente
2020-06-11 14:39     ` Jan Kara
2020-07-22  9:13       ` Paolo Valente
2020-07-27  7:35         ` Jan Kara
2020-08-26 13:54           ` Jan Kara
2020-09-02 15:17             ` Jan Kara
2021-01-10  9:23               ` Paolo Valente
2021-01-13  9:56                 ` Jan Kara
2021-01-13 10:09 ` [PATCH 1/3] bfq: Avoid false bfq queue merging Jan Kara
2021-01-13 10:09 ` [PATCH 2/3] bfq: Use 'ttime' local variable Jan Kara
2021-01-13 10:09 ` Jan Kara [this message]
2021-01-27 15:27 ` [PATCH 0/3 v2] bfq: Two fixes and a cleanup for sequential readers Jan Kara
2021-01-27 16:16   ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210113100937.8278-3-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=paolo.valente@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.