[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221108045224.19092-4-shikemeng@huawei.com>
Date: Tue, 8 Nov 2022 12:52:17 +0800
From: Kemeng Shi <shikemeng@...wei.com>
To: <paolo.valente@...aro.org>, <axboe@...nel.dk>
CC: <linux-block@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<shikemeng@...wei.com>
Subject: [PATCH 03/10] block, bfq: initialize bfqq->decrease_time_jif correctly
Currently, decrease_time_jif is initialized to 0 and will be updated in
function bfq_reset_inject_limit and bfq_update_inject_limit while these
two functions are called when jiffies pasts decrease_time_jif with some
extra time or think-time state changes. If jiffies is slightly larger
than MAX_JIFFY_OFFSET, it will take a long time to meet the first
condition. The second condition is heavily relies on process behavior. To
be more specific:
Function bfq_update_inject_limit maybe triggered when jiffies pasts
decrease_time_jif + msecs_to_jiffies(10) in bfq_add_request by setting
bfqd->wait_dispatch to true.
Function bfq_reset_inject_limit are called in two conditions:
1. jiffies pasts bfqq->decrease_time_jif + msecs_to_jiffies(1000) in
function bfq_add_request.
2. jiffies pasts bfqq->decrease_time_jif + msecs_to_jiffies(100) or
bfq think-time state change from short to long.
In worst case that jiffies is slightly larger than MAX_JIFFY_OFFSET
and think-time state never changes, the service injection may be not
triggered for a long time.
Fix this by initializing bfqq->decrease_time_jif to current jiffies
to trigger service injection soon when service injection conditions
are met.
Signed-off-by: Kemeng Shi <shikemeng@...wei.com>
---
block/bfq-iosched.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index fc71181a7e5d..01fa16047eb5 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -5557,6 +5557,8 @@ static void bfq_init_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq,
/* first request is almost certainly seeky */
bfqq->seek_history = 1;
+
+ bfqq->decrease_time_jif = jiffies;
}
static struct bfq_queue **bfq_async_queue_prio(struct bfq_data *bfqd,
--
2.30.0
Powered by blists - more mailing lists