Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer/dynticks updates from Ingo Molnar:
"This tree contains misc dynticks updates: a fix and three cleanups"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
sched/nohz: Fix overflow error in scheduler_tick_max_deferment()
nohz_full: fix code style issue of tick_nohz_full_stop_tick
nohz: Get timekeeping max deferment outside jiffies_lock
tick: Rename tick_check_idle() to tick_irq_enter()

+25 -18
+6
include/linux/jiffies.h
··· 294 */ 295 extern unsigned int jiffies_to_msecs(const unsigned long j); 296 extern unsigned int jiffies_to_usecs(const unsigned long j); 297 extern unsigned long msecs_to_jiffies(const unsigned int m); 298 extern unsigned long usecs_to_jiffies(const unsigned int u); 299 extern unsigned long timespec_to_jiffies(const struct timespec *value);
··· 294 */ 295 extern unsigned int jiffies_to_msecs(const unsigned long j); 296 extern unsigned int jiffies_to_usecs(const unsigned long j); 297 + 298 + static inline u64 jiffies_to_nsecs(const unsigned long j) 299 + { 300 + return (u64)jiffies_to_usecs(j) * NSEC_PER_USEC; 301 + } 302 + 303 extern unsigned long msecs_to_jiffies(const unsigned int m); 304 extern unsigned long usecs_to_jiffies(const unsigned int u); 305 extern unsigned long timespec_to_jiffies(const struct timespec *value);
+3 -3
include/linux/tick.h
··· 104 extern void tick_clock_notify(void); 105 extern int tick_check_oneshot_change(int allow_nohz); 106 extern struct tick_sched *tick_get_tick_sched(int cpu); 107 - extern void tick_check_idle(void); 108 extern int tick_oneshot_mode_active(void); 109 # ifndef arch_needs_cpu 110 # define arch_needs_cpu(cpu) (0) ··· 112 # else 113 static inline void tick_clock_notify(void) { } 114 static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 115 - static inline void tick_check_idle(void) { } 116 static inline int tick_oneshot_mode_active(void) { return 0; } 117 # endif 118 ··· 121 static inline void tick_cancel_sched_timer(int cpu) { } 122 static inline void tick_clock_notify(void) { } 123 static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 124 - static inline void tick_check_idle(void) { } 125 static inline int tick_oneshot_mode_active(void) { return 0; } 126 #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 127
··· 104 extern void tick_clock_notify(void); 105 extern int tick_check_oneshot_change(int allow_nohz); 106 extern struct tick_sched *tick_get_tick_sched(int cpu); 107 + extern void tick_irq_enter(void); 108 extern int tick_oneshot_mode_active(void); 109 # ifndef arch_needs_cpu 110 # define arch_needs_cpu(cpu) (0) ··· 112 # else 113 static inline void tick_clock_notify(void) { } 114 static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 115 + static inline void tick_irq_enter(void) { } 116 static inline int tick_oneshot_mode_active(void) { return 0; } 117 # endif 118 ··· 121 static inline void tick_cancel_sched_timer(int cpu) { } 122 static inline void tick_clock_notify(void) { } 123 static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 124 + static inline void tick_irq_enter(void) { } 125 static inline int tick_oneshot_mode_active(void) { return 0; } 126 #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 127
+1 -1
kernel/sched/core.c
··· 2476 if (time_before_eq(next, now)) 2477 return 0; 2478 2479 - return jiffies_to_usecs(next - now) * NSEC_PER_USEC; 2480 } 2481 #endif 2482
··· 2476 if (time_before_eq(next, now)) 2477 return 0; 2478 2479 + return jiffies_to_nsecs(next - now); 2480 } 2481 #endif 2482
+1 -1
kernel/softirq.c
··· 328 * here, as softirq will be serviced on return from interrupt. 329 */ 330 local_bh_disable(); 331 - tick_check_idle(); 332 _local_bh_enable(); 333 } 334
··· 328 * here, as softirq will be serviced on return from interrupt. 329 */ 330 local_bh_disable(); 331 + tick_irq_enter(); 332 _local_bh_enable(); 333 } 334
+14 -13
kernel/time/tick-sched.c
··· 533 struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev; 534 u64 time_delta; 535 536 /* Read jiffies and the time when jiffies were updated last */ 537 do { 538 seq = read_seqbegin(&jiffies_lock); 539 last_update = last_jiffies_update; 540 last_jiffies = jiffies; 541 - time_delta = timekeeping_max_deferment(); 542 } while (read_seqretry(&jiffies_lock, seq)); 543 544 if (rcu_needs_cpu(cpu, &rcu_delta_jiffies) || ··· 679 static void tick_nohz_full_stop_tick(struct tick_sched *ts) 680 { 681 #ifdef CONFIG_NO_HZ_FULL 682 - int cpu = smp_processor_id(); 683 684 - if (!tick_nohz_full_cpu(cpu) || is_idle_task(current)) 685 - return; 686 687 - if (!ts->tick_stopped && ts->nohz_mode == NOHZ_MODE_INACTIVE) 688 - return; 689 690 - if (!can_stop_full_tick()) 691 - return; 692 693 - tick_nohz_stop_sched_tick(ts, ktime_get(), cpu); 694 #endif 695 } 696 ··· 1024 #endif 1025 } 1026 1027 - static inline void tick_check_nohz_this_cpu(void) 1028 { 1029 struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); 1030 ktime_t now; ··· 1043 #else 1044 1045 static inline void tick_nohz_switch_to_nohz(void) { } 1046 - static inline void tick_check_nohz_this_cpu(void) { } 1047 1048 #endif /* CONFIG_NO_HZ_COMMON */ 1049 1050 /* 1051 * Called from irq_enter to notify about the possible interruption of idle() 1052 */ 1053 - void tick_check_idle(void) 1054 { 1055 tick_check_oneshot_broadcast_this_cpu(); 1056 - tick_check_nohz_this_cpu(); 1057 } 1058 1059 /*
··· 533 struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev; 534 u64 time_delta; 535 536 + time_delta = timekeeping_max_deferment(); 537 + 538 /* Read jiffies and the time when jiffies were updated last */ 539 do { 540 seq = read_seqbegin(&jiffies_lock); 541 last_update = last_jiffies_update; 542 last_jiffies = jiffies; 543 } while (read_seqretry(&jiffies_lock, seq)); 544 545 if (rcu_needs_cpu(cpu, &rcu_delta_jiffies) || ··· 678 static void tick_nohz_full_stop_tick(struct tick_sched *ts) 679 { 680 #ifdef CONFIG_NO_HZ_FULL 681 + int cpu = smp_processor_id(); 682 683 + if (!tick_nohz_full_cpu(cpu) || is_idle_task(current)) 684 + return; 685 686 + if (!ts->tick_stopped && ts->nohz_mode == NOHZ_MODE_INACTIVE) 687 + return; 688 689 + if (!can_stop_full_tick()) 690 + return; 691 692 + tick_nohz_stop_sched_tick(ts, ktime_get(), cpu); 693 #endif 694 } 695 ··· 1023 #endif 1024 } 1025 1026 + static inline void tick_nohz_irq_enter(void) 1027 { 1028 struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); 1029 ktime_t now; ··· 1042 #else 1043 1044 static inline void tick_nohz_switch_to_nohz(void) { } 1045 + static inline void tick_nohz_irq_enter(void) { } 1046 1047 #endif /* CONFIG_NO_HZ_COMMON */ 1048 1049 /* 1050 * Called from irq_enter to notify about the possible interruption of idle() 1051 */ 1052 + void tick_irq_enter(void) 1053 { 1054 tick_check_oneshot_broadcast_this_cpu(); 1055 + tick_nohz_irq_enter(); 1056 } 1057 1058 /*