[PATCH 01/17] block, bfq: properly mark bfqq remained idle

From: Kemeng Shi
Date: Sat Feb 18 2023 - 21:41:46 EST


Bfqq activation will try to recover the "service hole" of bfqq which may
issues requests greedily while remained idle for other reasons: CPU high
load, bfqq not enjoying idling, I/O throttling somewhere in the path from
the process to the I/O scheduler. So we should mark bfqq remained idle
when expired for two reasons: BFQQE_NO_MORE_REQUESTS or BFQQE_TOO_IDLE.
More details can be found in comment of
bfq_bfqq_update_budg_for_activation.
So we should mark bfqq remained idle expired for BFQQE_NO_MORE_REQUESTS
or BFQQE_TOO_IDLE instead of (reason != BFQQE_BUDGET_TIMEOUT &&
reason != BFQQE_BUDGET_EXHAUSTED).

Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
---
block/bfq-iosched.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 777dcab73c8e..3f5c740664ce 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -4420,8 +4420,8 @@ void bfq_bfqq_expire(struct bfq_data *bfqd,

/* mark bfqq as waiting a request only if a bic still points to it */
if (!bfq_bfqq_busy(bfqq) &&
- reason != BFQQE_BUDGET_TIMEOUT &&
- reason != BFQQE_BUDGET_EXHAUSTED) {
+ reason == BFQQE_NO_MORE_REQUESTS &&
+ reason == BFQQE_TOO_IDLE) {
bfq_mark_bfqq_non_blocking_wait_rq(bfqq);
/*
* Not setting service to 0, because, if the next rq
--
2.30.0