aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-05-25 18:08:57 -0400
committerThomas Gleixner <tglx@linutronix.de>2012-06-06 07:49:01 -0400
commitfacbb4a7efbd658046bf615f03cd97a1504785d8 (patch)
tree9264c078252a2246d93f92eef59a0975bcf614a8 /kernel
parentec44bc7acc3687ba6ae8154b4b5a845b70279237 (diff)
timers: Consolidate base->next_timer update
Another bunch of mindlessly copied code. All callers of internal_add_timer() except the recascading code updates base->next_timer. Move this into internal_add_timer() and let the cascading code call __internal_add_timer(). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Gilad Ben-Yossef <gilad@benyossef.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Link: http://lkml.kernel.org/r/20120525214819.189946224@linutronix.de
Diffstat (limited to 'kernel')
-rw-r--r--kernel/timer.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/kernel/timer.c b/kernel/timer.c
index 0f70deb20151..7207690b5353 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -330,7 +330,8 @@ void set_timer_slack(struct timer_list *timer, int slack_hz)
330} 330}
331EXPORT_SYMBOL_GPL(set_timer_slack); 331EXPORT_SYMBOL_GPL(set_timer_slack);
332 332
333static void internal_add_timer(struct tvec_base *base, struct timer_list *timer) 333static void
334__internal_add_timer(struct tvec_base *base, struct timer_list *timer)
334{ 335{
335 unsigned long expires = timer->expires; 336 unsigned long expires = timer->expires;
336 unsigned long idx = expires - base->timer_jiffies; 337 unsigned long idx = expires - base->timer_jiffies;
@@ -372,6 +373,17 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer)
372 list_add_tail(&timer->entry, vec); 373 list_add_tail(&timer->entry, vec);
373} 374}
374 375
376static void internal_add_timer(struct tvec_base *base, struct timer_list *timer)
377{
378 __internal_add_timer(base, timer);
379 /*
380 * Update base->next_timer if this is the earliest one.
381 */
382 if (time_before(timer->expires, base->next_timer) &&
383 !tbase_get_deferrable(timer->base))
384 base->next_timer = timer->expires;
385}
386
375#ifdef CONFIG_TIMER_STATS 387#ifdef CONFIG_TIMER_STATS
376void __timer_stats_timer_set_start_info(struct timer_list *timer, void *addr) 388void __timer_stats_timer_set_start_info(struct timer_list *timer, void *addr)
377{ 389{
@@ -757,9 +769,6 @@ __mod_timer(struct timer_list *timer, unsigned long expires,
757 } 769 }
758 770
759 timer->expires = expires; 771 timer->expires = expires;
760 if (time_before(timer->expires, base->next_timer) &&
761 !tbase_get_deferrable(timer->base))
762 base->next_timer = timer->expires;
763 internal_add_timer(base, timer); 772 internal_add_timer(base, timer);
764 773
765out_unlock: 774out_unlock:
@@ -925,9 +934,6 @@ void add_timer_on(struct timer_list *timer, int cpu)
925 spin_lock_irqsave(&base->lock, flags); 934 spin_lock_irqsave(&base->lock, flags);
926 timer_set_base(timer, base); 935 timer_set_base(timer, base);
927 debug_activate(timer, timer->expires); 936 debug_activate(timer, timer->expires);
928 if (time_before(timer->expires, base->next_timer) &&
929 !tbase_get_deferrable(timer->base))
930 base->next_timer = timer->expires;
931 internal_add_timer(base, timer); 937 internal_add_timer(base, timer);
932 /* 938 /*
933 * Check whether the other CPU is idle and needs to be 939 * Check whether the other CPU is idle and needs to be
@@ -1079,7 +1085,8 @@ static int cascade(struct tvec_base *base, struct tvec *tv, int index)
1079 */ 1085 */
1080 list_for_each_entry_safe(timer, tmp, &tv_list, entry) { 1086 list_for_each_entry_safe(timer, tmp, &tv_list, entry) {
1081 BUG_ON(tbase_get_base(timer->base) != base); 1087 BUG_ON(tbase_get_base(timer->base) != base);
1082 internal_add_timer(base, timer); 1088 /* No accounting, while moving them */
1089 __internal_add_timer(base, timer);
1083 } 1090 }
1084 1091
1085 return index; 1092 return index;
@@ -1706,9 +1713,6 @@ static void migrate_timer_list(struct tvec_base *new_base, struct list_head *hea
1706 timer = list_first_entry(head, struct timer_list, entry); 1713 timer = list_first_entry(head, struct timer_list, entry);
1707 detach_timer(timer, false); 1714 detach_timer(timer, false);
1708 timer_set_base(timer, new_base); 1715 timer_set_base(timer, new_base);
1709 if (time_before(timer->expires, new_base->next_timer) &&
1710 !tbase_get_deferrable(timer->base))
1711 new_base->next_timer = timer->expires;
1712 internal_add_timer(new_base, timer); 1716 internal_add_timer(new_base, timer);
1713 } 1717 }
1714} 1718}