Skip to contentSkip to conversation

CFQ: fix stall on force dispatch

PATCH New Tejun Heo 1 participant 1 message May 29, 2005 Block layer

lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

PATCH 1/1 CFQ: fix stall on force dispatch

Hello, Jens.
Hello, Andrew.

The cfq-cfq-elevator_insert_back-fix.patch contains a bug which is
triggered if force dispatching (back insertion) occurs when the active cfqq is in idle slice while there exist other requests on other cfqqs.

In this case, the idle slice timer is removed without invoking the
timer handler, so CFQ itself doesn't run the queue. Also, as the queue wasn't empty when the elv_add_request() is invoked, the blk layer won't kick the queue on return. This results in queue stall.

This patch removes the stall by kicking the queue after force
dispatching.

drivers/block/cfq-iosched.c +8 -0
Index: blk-fixes/drivers/block/cfq-iosched.c
===================================================================
@@ -1705,6 +1705,14 @@ cfq_insert_request(request_queue_t *q, s
 			while (cfq_dispatch_requests(q, INT_MAX, 1))
 				;
 			list_add_tail(&rq->queuelist, &q->queue_head);
+			/*
+			 * If we were idling with pending requests on
+			 * inactive cfqqs, force dispatching will
+			 * remove the idle timer and the queue won't
+			 * be kicked by __make_request() afterward.
+			 * Kick it here.
+			 */
+			kblockd_schedule_work(&cfqd->unplug_work);
 			break;
 		case ELEVATOR_INSERT_FRONT:
 			list_add(&rq->queuelist, &q->queue_head);