cfq-iosched: Don't clear queue stats when preempt.

For v2, I added back lines to cfq_preempt_queue() that were removed
during updates for accounting unaccounted_time. Thanks for pointing out
that I'd missed these, Vivek.

Previous commit "cfq-iosched: Don't set active queue in preempt" wrongly
cleared stats for preempting queues when it shouldn't have, because when
we choose a queue to preempt, it still isn't necessarily scheduled next.

Thanks to Vivek Goyal for figuring this out and understanding how the
preemption code works.

Signed-off-by: Justin TerAvest <teravest@google.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>

authored by Justin TerAvest and committed by Jens Axboe 62a37f6b 04521db0

+17 -22
+17 -22
block/cfq-iosched.c
··· 1620 cfq_blkiocg_update_idle_time_stats(&cfqq->cfqg->blkg); 1621 } 1622 1623 - static void cfq_clear_queue_stats(struct cfq_data *cfqd, 1624 - struct cfq_queue *cfqq) 1625 - { 1626 - cfq_blkiocg_update_avg_queue_size_stats(&cfqq->cfqg->blkg); 1627 - cfqq->slice_start = 0; 1628 - cfqq->dispatch_start = jiffies; 1629 - cfqq->allocated_slice = 0; 1630 - cfqq->slice_end = 0; 1631 - cfqq->slice_dispatch = 0; 1632 - cfqq->nr_sectors = 0; 1633 - 1634 - cfq_clear_cfqq_wait_request(cfqq); 1635 - cfq_clear_cfqq_must_dispatch(cfqq); 1636 - cfq_clear_cfqq_must_alloc_slice(cfqq); 1637 - cfq_clear_cfqq_fifo_expire(cfqq); 1638 - cfq_mark_cfqq_slice_new(cfqq); 1639 - 1640 - cfq_del_timer(cfqd, cfqq); 1641 - } 1642 - 1643 static void __cfq_set_active_queue(struct cfq_data *cfqd, 1644 struct cfq_queue *cfqq) 1645 { 1646 if (cfqq) { 1647 cfq_log_cfqq(cfqd, cfqq, "set_active wl_prio:%d wl_type:%d", 1648 cfqd->serving_prio, cfqd->serving_type); 1649 - cfq_clear_queue_stats(cfqd, cfqq); 1650 } 1651 1652 cfqd->active_queue = cfqq; ··· 3333 3334 cfq_service_tree_add(cfqd, cfqq, 1); 3335 3336 - cfq_clear_queue_stats(cfqd, cfqq); 3337 } 3338 3339 /*
··· 1620 cfq_blkiocg_update_idle_time_stats(&cfqq->cfqg->blkg); 1621 } 1622 1623 static void __cfq_set_active_queue(struct cfq_data *cfqd, 1624 struct cfq_queue *cfqq) 1625 { 1626 if (cfqq) { 1627 cfq_log_cfqq(cfqd, cfqq, "set_active wl_prio:%d wl_type:%d", 1628 cfqd->serving_prio, cfqd->serving_type); 1629 + cfq_blkiocg_update_avg_queue_size_stats(&cfqq->cfqg->blkg); 1630 + cfqq->slice_start = 0; 1631 + cfqq->dispatch_start = jiffies; 1632 + cfqq->allocated_slice = 0; 1633 + cfqq->slice_end = 0; 1634 + cfqq->slice_dispatch = 0; 1635 + cfqq->nr_sectors = 0; 1636 + 1637 + cfq_clear_cfqq_wait_request(cfqq); 1638 + cfq_clear_cfqq_must_dispatch(cfqq); 1639 + cfq_clear_cfqq_must_alloc_slice(cfqq); 1640 + cfq_clear_cfqq_fifo_expire(cfqq); 1641 + cfq_mark_cfqq_slice_new(cfqq); 1642 + 1643 + cfq_del_timer(cfqd, cfqq); 1644 } 1645 1646 cfqd->active_queue = cfqq; ··· 3339 3340 cfq_service_tree_add(cfqd, cfqq, 1); 3341 3342 + cfqq->slice_end = 0; 3343 + cfq_mark_cfqq_slice_new(cfqq); 3344 } 3345 3346 /*