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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Chunguang Xu <brookxu@xxxxxxxxxxx>

From: Chunguang Xu <brookxu@xxxxxxxxxxx>

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@xxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux