aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorJan Kara <jack@suse.com>2016-06-08 09:11:39 -0400
committerJens Axboe <axboe@fb.com>2016-06-08 10:56:06 -0400
commit9114832581645e48622152a4ef21b88920c0167b (patch)
tree1a7619ab9bc8e7e509cc167cabfa08394d104a07 /block
parentd2d481d04f70325e7ed45cbd6e72c15e745f6ede (diff)
cfq-iosched: Convert to use highres timers
Reviewed-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Jan Kara <jack@suse.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/cfq-iosched.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 2db7b1450dd9..4e5978426ee7 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -362,7 +362,7 @@ struct cfq_data {
362 /* 362 /*
363 * idle window management 363 * idle window management
364 */ 364 */
365 struct timer_list idle_slice_timer; 365 struct hrtimer idle_slice_timer;
366 struct work_struct unplug_work; 366 struct work_struct unplug_work;
367 367
368 struct cfq_queue *active_queue; 368 struct cfq_queue *active_queue;
@@ -2627,7 +2627,7 @@ static int cfq_allow_merge(struct request_queue *q, struct request *rq,
2627 2627
2628static inline void cfq_del_timer(struct cfq_data *cfqd, struct cfq_queue *cfqq) 2628static inline void cfq_del_timer(struct cfq_data *cfqd, struct cfq_queue *cfqq)
2629{ 2629{
2630 del_timer(&cfqd->idle_slice_timer); 2630 hrtimer_try_to_cancel(&cfqd->idle_slice_timer);
2631 cfqg_stats_update_idle_time(cfqq->cfqg); 2631 cfqg_stats_update_idle_time(cfqq->cfqg);
2632} 2632}
2633 2633
@@ -2989,7 +2989,8 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd)
2989 else 2989 else
2990 sl = cfqd->cfq_slice_idle; 2990 sl = cfqd->cfq_slice_idle;
2991 2991
2992 mod_timer(&cfqd->idle_slice_timer, now + sl); 2992 hrtimer_start(&cfqd->idle_slice_timer, ns_to_ktime(sl),
2993 HRTIMER_MODE_REL);
2993 cfqg_stats_set_start_idle_time(cfqq->cfqg); 2994 cfqg_stats_set_start_idle_time(cfqq->cfqg);
2994 cfq_log_cfqq(cfqd, cfqq, "arm_idle: %llu group_idle: %d", sl, 2995 cfq_log_cfqq(cfqd, cfqq, "arm_idle: %llu group_idle: %d", sl,
2995 group_idle ? 1 : 0); 2996 group_idle ? 1 : 0);
@@ -3308,7 +3309,7 @@ static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd)
3308 * flight or is idling for a new request, allow either of these 3309 * flight or is idling for a new request, allow either of these
3309 * conditions to happen (or time out) before selecting a new queue. 3310 * conditions to happen (or time out) before selecting a new queue.
3310 */ 3311 */
3311 if (timer_pending(&cfqd->idle_slice_timer)) { 3312 if (hrtimer_active(&cfqd->idle_slice_timer)) {
3312 cfqq = NULL; 3313 cfqq = NULL;
3313 goto keep_queue; 3314 goto keep_queue;
3314 } 3315 }
@@ -4454,9 +4455,10 @@ static void cfq_kick_queue(struct work_struct *work)
4454/* 4455/*
4455 * Timer running if the active_queue is currently idling inside its time slice 4456 * Timer running if the active_queue is currently idling inside its time slice
4456 */ 4457 */
4457static void cfq_idle_slice_timer(unsigned long data) 4458static enum hrtimer_restart cfq_idle_slice_timer(struct hrtimer *timer)
4458{ 4459{
4459 struct cfq_data *cfqd = (struct cfq_data *) data; 4460 struct cfq_data *cfqd = container_of(timer, struct cfq_data,
4461 idle_slice_timer);
4460 struct cfq_queue *cfqq; 4462 struct cfq_queue *cfqq;
4461 unsigned long flags; 4463 unsigned long flags;
4462 int timed_out = 1; 4464 int timed_out = 1;
@@ -4505,11 +4507,12 @@ out_kick:
4505 cfq_schedule_dispatch(cfqd); 4507 cfq_schedule_dispatch(cfqd);
4506out_cont: 4508out_cont:
4507 spin_unlock_irqrestore(cfqd->queue->queue_lock, flags); 4509 spin_unlock_irqrestore(cfqd->queue->queue_lock, flags);
4510 return HRTIMER_NORESTART;
4508} 4511}
4509 4512
4510static void cfq_shutdown_timer_wq(struct cfq_data *cfqd) 4513static void cfq_shutdown_timer_wq(struct cfq_data *cfqd)
4511{ 4514{
4512 del_timer_sync(&cfqd->idle_slice_timer); 4515 hrtimer_cancel(&cfqd->idle_slice_timer);
4513 cancel_work_sync(&cfqd->unplug_work); 4516 cancel_work_sync(&cfqd->unplug_work);
4514} 4517}
4515 4518
@@ -4605,9 +4608,9 @@ static int cfq_init_queue(struct request_queue *q, struct elevator_type *e)
4605 cfqg_put(cfqd->root_group); 4608 cfqg_put(cfqd->root_group);
4606 spin_unlock_irq(q->queue_lock); 4609 spin_unlock_irq(q->queue_lock);
4607 4610
4608 init_timer(&cfqd->idle_slice_timer); 4611 hrtimer_init(&cfqd->idle_slice_timer, CLOCK_MONOTONIC,
4612 HRTIMER_MODE_REL);
4609 cfqd->idle_slice_timer.function = cfq_idle_slice_timer; 4613 cfqd->idle_slice_timer.function = cfq_idle_slice_timer;
4610 cfqd->idle_slice_timer.data = (unsigned long) cfqd;
4611 4614
4612 INIT_WORK(&cfqd->unplug_work, cfq_kick_queue); 4615 INIT_WORK(&cfqd->unplug_work, cfq_kick_queue);
4613 4616