Skip to contentSkip to conversation

blk: cfq_find_next_crq fix

PATCH In review Tejun Heo 2 participants 2 messages Jun 16, 2005 Block layer

lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

PATCH 1/1 blk: cfq_find_next_crq fix

Hello, Jens.
Hello, Andrew.

In cfq_find_next_crq(), cfq tries to find the next request by
choosing one of two requests before and after the current one. Currently, when choosing the next request, if there's no next request, the next candidate is NULL, resulting in selection of the previous request. This results in weird scheduling. Once we reach the end, we always seek backward.

The correct behavior is using the first request as the next
candidate. cfq_choose_req() already has logics for handling wrapped requests.

drivers/block/cfq-iosched.c +2 -1
Index: blk-fixes/drivers/block/cfq-iosched.c
===================================================================
@@ -375,9 +375,10 @@ cfq_find_next_crq(struct cfq_data *cfqd,
 	struct cfq_rq *crq_next = NULL, *crq_prev = NULL;
 	struct rb_node *rbnext, *rbprev;
 
+	rbnext = NULL;
 	if (ON_RB(&last->rb_node))
 		rbnext = rb_next(&last->rb_node);
-	else {
+	if (!rbnext) {
 		rbnext = rb_first(&cfqq->sort_list);
 		if (rbnext == &last->rb_node)
 			rbnext = NULL;
#1 lore raw
Quoted 10 lines · Tejun Heo

Hello, Jens.
Hello, Andrew.

In cfq_find_next_crq(), cfq tries to find the next request by
choosing one of two requests before and after the current one. Currently, when choosing the next request, if there's no next request, the next candidate is NULL, resulting in selection of the previous request. This results in weird scheduling. Once we reach the end, we always seek backward.

Quoted 3 lines

The correct behavior is using the first request as the next
candidate. cfq_choose_req() already has logics for handling wrapped requests.

Good spotting, applied. I'll set up an iosched git tree as well, with a cfq-ts branch.

Signature · 1 line
Jens Axboe