diff --git a/include/linux/timer.h b/include/linux/timer.h index fb5edaaf0ebd11a05500ef64e1e56df5fa4f295b..bd0af324fd487e9fbbba15ff2daf283de08773b5 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -61,7 +61,17 @@ extern int del_timer(struct timer_list * timer); extern int __mod_timer(struct timer_list *timer, unsigned long expires); extern int mod_timer(struct timer_list *timer, unsigned long expires); +/* + * Return when the next timer-wheel timeout occurs (in absolute jiffies), + * locks the timer base: + */ extern unsigned long next_timer_interrupt(void); +/* + * Return when the next timer-wheel timeout occurs (in absolute jiffies), + * locks the timer base and does the comparison against the given + * jiffie. + */ +extern unsigned long get_next_timer_interrupt(unsigned long now); /** * add_timer - start a timer diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index c0fdb9b6d296ac8eac6270fa58f21241d68f984d..bd57ef40304958dc3f1123256b2730752311e04a 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -533,7 +533,7 @@ ktime_t hrtimer_get_remaining(const struct hrtimer *timer) } EXPORT_SYMBOL_GPL(hrtimer_get_remaining); -#ifdef CONFIG_NO_IDLE_HZ +#if defined(CONFIG_NO_IDLE_HZ) || defined(CONFIG_NO_HZ) /** * hrtimer_get_next_event - get the time until next expiry event * diff --git a/kernel/timer.c b/kernel/timer.c index 201bee07b8e030afdf36952b93b38b37c718ba96..6d843e100e75d9c6ce2ccb269bf7c4dd6839e32f 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -591,7 +591,7 @@ static inline void __run_timers(tvec_base_t *base) spin_unlock_irq(&base->lock); } -#ifdef CONFIG_NO_IDLE_HZ +#if defined(CONFIG_NO_IDLE_HZ) || defined(CONFIG_NO_HZ) /* * Find out when the next timer event is due to happen. This * is used on S/390 to stop all activity when a cpus is idle. @@ -687,10 +687,10 @@ static unsigned long cmp_next_hrtimer_event(unsigned long now, /** * next_timer_interrupt - return the jiffy of the next pending timer */ -unsigned long next_timer_interrupt(void) +unsigned long get_next_timer_interrupt(unsigned long now) { tvec_base_t *base = __get_cpu_var(tvec_bases); - unsigned long expires, now = jiffies; + unsigned long expires; spin_lock(&base->lock); expires = __next_timer_interrupt(base); @@ -701,6 +701,14 @@ unsigned long next_timer_interrupt(void) return cmp_next_hrtimer_event(now, expires); } + +#ifdef CONFIG_NO_IDLE_HZ +unsigned long next_timer_interrupt(void) +{ + return get_next_timer_interrupt(jiffies); +} +#endif + #endif /******************************************************************/