cfq: fix IOPRIO_CLASS_IDLE delays
authorOleg Nesterov <oleg@tv-sign.ru>
Wed, 7 Nov 2007 08:46:13 +0000 (09:46 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 7 Nov 2007 08:46:13 +0000 (09:46 +0100)
After the fresh boot:

ionice -c3 -p $$
echo cfq >> /sys/block/XXX/queue/scheduler
dd if=/dev/XXX of=/dev/null bs=512 count=1

Now dd hangs in D state and the queue is completely stalled for approximately
INITIAL_JIFFIES + CFQ_IDLE_GRACE jiffies. This is because cfq_init_queue()
forgets to initialize cfq_data->last_end_request.

(I guess this patch is not complete, overflow is still possible)

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/cfq-iosched.c

index 61a3f22eee2990a4b833dd264ce41c01db7bf6b4..6831a758d5412ff93305c7ca9e74c5b7f7292895 100644 (file)
@@ -2126,6 +2126,7 @@ static void *cfq_init_queue(struct request_queue *q)
 
        INIT_WORK(&cfqd->unplug_work, cfq_kick_queue);
 
+       cfqd->last_end_request = jiffies;
        cfqd->cfq_quantum = cfq_quantum;
        cfqd->cfq_fifo_expire[0] = cfq_fifo_expire[0];
        cfqd->cfq_fifo_expire[1] = cfq_fifo_expire[1];