All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: <linux-block@vger.kernel.org>
Cc: Paolo Valente <paolo.valente@linaro.org>, Jan Kara <jack@suse.cz>,
	stable@vger.kernel.org
Subject: [PATCH 1/3] bfq: Avoid false bfq queue merging
Date: Fri,  5 Jun 2020 16:16:16 +0200	[thread overview]
Message-ID: <20200605141629.15347-1-jack@suse.cz> (raw)
In-Reply-To: <20200605140837.5394-1-jack@suse.cz>

bfq_setup_cooperator() uses bfqd->in_serv_last_pos so detect whether it
makes sense to merge current bfq queue with the in-service queue.
However if the in-service queue is freshly scheduled and didn't dispatch
any requests yet, bfqd->in_serv_last_pos is stale and contains value
from the previously scheduled bfq queue which can thus result in a bogus
decision that the two queues should be merged. This bug can be observed
for example with the following fio jobfile:

[global]
direct=0
ioengine=sync
invalidate=1
size=1g
rw=read

[reader]
numjobs=4
directory=/mnt

where the 4 processes will end up in the one shared bfq queue although
they do IO to physically very distant files (for some reason I was able to
observe this only with slice_idle=1ms setting).

Fix the problem by invalidating bfqd->in_serv_last_pos when switching
in-service queue.

Fixes: 058fdecc6de7 ("block, bfq: fix in-service-queue check for queue merging")
CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 block/bfq-iosched.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 3d411716d7ee..50017275915f 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -2937,6 +2937,7 @@ static void __bfq_set_in_service_queue(struct bfq_data *bfqd,
 	}
 
 	bfqd->in_service_queue = bfqq;
+	bfqd->in_serv_last_pos = 0;
 }
 
 /*
-- 
2.16.4


  reply	other threads:[~2020-06-05 14:16 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 ` Jan Kara [this message]
2020-06-11  7:13   ` [PATCH 1/3] bfq: Avoid false bfq queue merging 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 ` [PATCH 3/3] bfq: Use only idle IO periods for think time calculations Jan Kara
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=20200605141629.15347-1-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=paolo.valente@linaro.org \
    --cc=stable@vger.kernel.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.