[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230219104309.1511562-3-shikemeng@huaweicloud.com>
Date: Sun, 19 Feb 2023 18:42:54 +0800
From: Kemeng Shi <shikemeng@...weicloud.com>
To: paolo.valente@...aro.org, axboe@...nel.dk, jack@...e.cz
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
shikemeng@...weicloud.com
Subject: [PATCH 02/17] block, bfq: try preemption if bfqq has higher weight and the same priority class
We will compare priority class and weight of current bfqq with
in_service_queue to check if bfqq could preempt in_service_queue.
Currently we will try to preempt in_service_queue if bfqq has higher
weight than in_service_queue even with lower priority class. Actually,
we will only serve bfqq with higher priority class (see
bfq_lookup_next_entity), so bfqq with higher weight and lower priority
class will not be a candidate to preempt in_service_queue.
Compare weight of bfqqs with the same priority in
bfq_bfqq_higher_class_or_weight to make preemption check more reasonable.
Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>
---
block/bfq-iosched.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 3f5c740664ce..4868538c9745 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -1768,6 +1768,10 @@ static bool bfq_bfqq_higher_class_or_weight(struct bfq_queue *bfqq,
if (bfqq->ioprio_class < in_serv_bfqq->ioprio_class)
return true;
+ /* only try weight comparison with same priority class */
+ if (bfqq->ioprio_class != in_serv_bfqq->ioprio_class)
+ return false;
+
if (in_serv_bfqq->entity.parent == bfqq->entity.parent) {
bfqq_weight = bfqq->entity.weight;
in_serv_weight = in_serv_bfqq->entity.weight;
--
2.30.0
Powered by blists - more mailing lists