Skip to contentSkip to conversation

block,bfq: fix the timeout calculation in bfq_bfqq_charge_time

PATCH In review Rokudo Yan 2 participants 2 messages Mar 24, 2021 – Apr 2, 2021

Subsystems (2)
lore
Share & tools
lore

Rokudo Yan

author
#0 lore raw

PATCH 1/1 block,bfq: fix the timeout calculation in bfq_bfqq_charge_time

in bfq_bfqq_charge_time, timeout_ms is calculated with global constant bfq_timeout(HZ/8), which is not correct. It should be bfqd->bfq_timeout here as per-device bfq_timeout can be modified through /sys/block/<disk/queue/iosched/timeout_sync.

---
 block/bfq-wf2q.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/bfq-wf2q.c +1 -1
index 070e34a7feb1..48f540a5ee6a 100644
@@ -872,7 +872,7 @@ void bfq_bfqq_charge_time(struct bfq_data *bfqd, struct bfq_queue *bfqq,
 			  unsigned long time_ms)
 {
 	struct bfq_entity *entity = &bfqq->entity;
-	unsigned long timeout_ms = jiffies_to_msecs(bfq_timeout);
+	unsigned long timeout_ms = jiffies_to_msecs(bfqd->bfq_timeout);
 	unsigned long bounded_time_ms = min(time_ms, timeout_ms);
 	int serv_to_charge_for_time =
 		(bfqd->bfq_max_budget * bounded_time_ms) / timeout_ms;
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines

Il giorno 24 mar 2021, alle ore 03:33, Rokudo Yan <[email protected]> ha scritto:

in bfq_bfqq_charge_time, timeout_ms is calculated with global constant bfq_timeout(HZ/8), which is not correct. It should be bfqd->bfq_timeout here as per-device bfq_timeout can be modified through /sys/block/<disk/queue/iosched/timeout_sync.

Hi,
thanks for spotting this.

Quoted 21 lines

---
block/bfq-wf2q.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
block/bfq-wf2q.c +1 -1
index 070e34a7feb1..48f540a5ee6a 100644
@@ -872,7 +872,7 @@ void bfq_bfqq_charge_time(struct bfq_data *bfqd, struct bfq_queue *bfqq,
 			  unsigned long time_ms)
 {
 	struct bfq_entity *entity = &bfqq->entity;
-	unsigned long timeout_ms = jiffies_to_msecs(bfq_timeout);
+	unsigned long timeout_ms = jiffies_to_msecs(bfqd->bfq_timeout);
 	unsigned long bounded_time_ms = min(time_ms, timeout_ms);
 	int serv_to_charge_for_time =
 		(bfqd->bfq_max_budget * bounded_time_ms) / timeout_ms;
Signature · 1 line
2.25.1