aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/tick-sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/time/tick-sched.c')
-rw-r--r--kernel/time/tick-sched.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index f5da526424a9..cb02324bdb88 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -75,6 +75,9 @@ static void tick_do_update_jiffies64(ktime_t now)
75 incr * ticks); 75 incr * ticks);
76 } 76 }
77 do_timer(++ticks); 77 do_timer(++ticks);
78
79 /* Keep the tick_next_period variable up to date */
80 tick_next_period = ktime_add(last_jiffies_update, tick_period);
78 } 81 }
79 write_sequnlock(&xtime_lock); 82 write_sequnlock(&xtime_lock);
80} 83}
@@ -162,6 +165,8 @@ void tick_nohz_stop_idle(int cpu)
162 ts->idle_lastupdate = now; 165 ts->idle_lastupdate = now;
163 ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta); 166 ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
164 ts->idle_active = 0; 167 ts->idle_active = 0;
168
169 sched_clock_idle_wakeup_event(0);
165 } 170 }
166} 171}
167 172
@@ -177,6 +182,7 @@ static ktime_t tick_nohz_start_idle(struct tick_sched *ts)
177 } 182 }
178 ts->idle_entrytime = now; 183 ts->idle_entrytime = now;
179 ts->idle_active = 1; 184 ts->idle_active = 1;
185 sched_clock_idle_sleep_event();
180 return now; 186 return now;
181} 187}
182 188
@@ -218,7 +224,7 @@ void tick_nohz_stop_sched_tick(int inidle)
218 */ 224 */
219 if (unlikely(!cpu_online(cpu))) { 225 if (unlikely(!cpu_online(cpu))) {
220 if (cpu == tick_do_timer_cpu) 226 if (cpu == tick_do_timer_cpu)
221 tick_do_timer_cpu = -1; 227 tick_do_timer_cpu = TICK_DO_TIMER_NONE;
222 } 228 }
223 229
224 if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE)) 230 if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE))
@@ -300,7 +306,7 @@ void tick_nohz_stop_sched_tick(int inidle)
300 * invoked. 306 * invoked.
301 */ 307 */
302 if (cpu == tick_do_timer_cpu) 308 if (cpu == tick_do_timer_cpu)
303 tick_do_timer_cpu = -1; 309 tick_do_timer_cpu = TICK_DO_TIMER_NONE;
304 310
305 ts->idle_sleeps++; 311 ts->idle_sleeps++;
306 312
@@ -465,7 +471,7 @@ static void tick_nohz_handler(struct clock_event_device *dev)
465 * this duty, then the jiffies update is still serialized by 471 * this duty, then the jiffies update is still serialized by
466 * xtime_lock. 472 * xtime_lock.
467 */ 473 */
468 if (unlikely(tick_do_timer_cpu == -1)) 474 if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE))
469 tick_do_timer_cpu = cpu; 475 tick_do_timer_cpu = cpu;
470 476
471 /* Check, if the jiffies need an update */ 477 /* Check, if the jiffies need an update */
@@ -567,7 +573,7 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)
567 * this duty, then the jiffies update is still serialized by 573 * this duty, then the jiffies update is still serialized by
568 * xtime_lock. 574 * xtime_lock.
569 */ 575 */
570 if (unlikely(tick_do_timer_cpu == -1)) 576 if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE))
571 tick_do_timer_cpu = cpu; 577 tick_do_timer_cpu = cpu;
572#endif 578#endif
573 579
@@ -619,7 +625,7 @@ void tick_setup_sched_timer(void)
619 */ 625 */
620 hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); 626 hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
621 ts->sched_timer.function = tick_sched_timer; 627 ts->sched_timer.function = tick_sched_timer;
622 ts->sched_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ; 628 ts->sched_timer.cb_mode = HRTIMER_CB_IRQSAFE_PERCPU;
623 629
624 /* Get the next period (per cpu) */ 630 /* Get the next period (per cpu) */
625 ts->sched_timer.expires = tick_init_jiffy_update(); 631 ts->sched_timer.expires = tick_init_jiffy_update();
@@ -643,17 +649,21 @@ void tick_setup_sched_timer(void)
643 ts->nohz_mode = NOHZ_MODE_HIGHRES; 649 ts->nohz_mode = NOHZ_MODE_HIGHRES;
644#endif 650#endif
645} 651}
652#endif /* HIGH_RES_TIMERS */
646 653
654#if defined CONFIG_NO_HZ || defined CONFIG_HIGH_RES_TIMERS
647void tick_cancel_sched_timer(int cpu) 655void tick_cancel_sched_timer(int cpu)
648{ 656{
649 struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu); 657 struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
650 658
659# ifdef CONFIG_HIGH_RES_TIMERS
651 if (ts->sched_timer.base) 660 if (ts->sched_timer.base)
652 hrtimer_cancel(&ts->sched_timer); 661 hrtimer_cancel(&ts->sched_timer);
662# endif
653 663
654 ts->nohz_mode = NOHZ_MODE_INACTIVE; 664 ts->nohz_mode = NOHZ_MODE_INACTIVE;
655} 665}
656#endif /* HIGH_RES_TIMERS */ 666#endif
657 667
658/** 668/**
659 * Async notification about clocksource changes 669 * Async notification about clocksource changes