[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <055c82a8f016a0e918e69ac6700a5839a7f4bfaf.1615203034.git.brookxu@tencent.com>
Date: Mon, 8 Mar 2021 20:00:17 +0800
From: brookxu <brookxu.cn@...il.com>
To: paolo.valente@...aro.org, axboe@...nel.dk, tj@...nel.org
Cc: linux-block@...r.kernel.org, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH 4/8] bfq: expire bfqq if a higher priority class is waiting
From: Chunguang Xu <brookxu@...cent.com>
From: Chunguang Xu <brookxu@...cent.com>
Expire bfqq If a higher priority class is waiting to be served, we
can further guarantee the delay of the higher priority class.
Signed-off-by: Chunguang Xu <brookxu@...cent.com>
---
block/bfq-iosched.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index b639cdbb4192..223affaa7c92 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -4677,7 +4677,10 @@ static struct request *bfq_dispatch_rq_from_bfqq(struct bfq_data *bfqd,
struct bfq_queue *bfqq)
{
struct request *rq = bfqq->next_rq;
+ struct bfq_sched_data *sd = bfqq->entity.sched_data;
+ struct bfq_service_tree *st = sd->service_tree;
unsigned long service_to_charge;
+ int idx;
service_to_charge = bfq_serv_to_charge(rq, bfqq);
@@ -4714,6 +4717,17 @@ static struct request *bfq_dispatch_rq_from_bfqq(struct bfq_data *bfqd,
if (!(bfq_tot_busy_queues(bfqd) > 1 && bfq_class_idle(bfqq)))
goto return_rq;
+ /*
+ * Expire bfqq, if other queues belong to higher priority
+ * class are waiting for service.
+ */
+ for (idx = bfqq->ioprio_class - 2; idx >= 0; idx--) {
+ if (!RB_EMPTY_ROOT(&(st + idx)->active))
+ break;
+ }
+ if (idx < 0)
+ goto return_rq;
+
bfq_bfqq_expire(bfqd, bfqq, false, BFQQE_BUDGET_EXHAUSTED);
return_rq:
--
2.30.0
Powered by blists - more mailing lists