Thread (9 messages) 9 messages, 1 author, 2021-03-08
DORMANTno replies
Revisions (3)
  1. rfc current
  2. v2 [diff vs current]
  3. v3 [diff vs current]

[RFC PATCH 4/8] bfq: expire bfqq if a higher priority class is waiting

From: brookxu <hidden>
Date: 2021-03-08 12:01:22
Also in: cgroups, lkml
Subsystem: bfq i/o scheduler, block layer, the rest · Maintainers: Yu Kuai, Jens Axboe, Linus Torvalds

From: Chunguang Xu <redacted>

From: Chunguang Xu <redacted>

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help