From fd064b9b7770d5c7705bf9542950c7bd81c30f98 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Fri, 16 Feb 2007 01:27:47 -0800 Subject: [PATCH] Extend next_timer_interrupt() to use a reference jiffie For CONFIG_NO_HZ we need to calculate the next timer wheel event based on a given jiffie value. Extend the existing code to allow the extra 'now' argument. Provide a compability function for the existing implementations to call the function with now == jiffies. (This also solves the racyness of the original code vs. jiffies changing during the iteration.) No functional changes to existing users of this infrastructure. [ remove WARN_ON() that triggered on s390, by Carsten Otte ] [ made new helper static, Adrian Bunk ] Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar Cc: john stultz Cc: Roman Zippel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/timer.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'kernel/timer.c') diff --git a/kernel/timer.c b/kernel/timer.c index 201bee07b8e..6d843e100e7 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 /******************************************************************/ -- cgit v1.2.3