[PATCH 02/17] block, bfq: try preemption if bfqq has higher weight and the same priority class

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

 



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




[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