aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/timer.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 12:46:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 12:46:15 -0400
commit31bbb9b58d1e8ebcf2b28c95c2250a9f8e31e397 (patch)
tree6bb0c0490d66d32eca43e73abb28d8b3ab0e7b91 /kernel/timer.c
parentff830b8e5f999d1ccbd0282a666520f0b557daa4 (diff)
parent3f0a525ebf4b8ef041a332bbe4a73aee94bb064b (diff)
Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: itimers: Add tracepoints for itimer hrtimer: Add tracepoint for hrtimers timers: Add tracepoints for timer_list timers cputime: Optimize jiffies_to_cputime(1) itimers: Simplify arm_timer() code a bit itimers: Fix periodic tics precision itimers: Merge ITIMER_VIRT and ITIMER_PROF Trivial header file include conflicts in kernel/fork.c
Diffstat (limited to 'kernel/timer.c')
-rw-r--r--kernel/timer.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/kernel/timer.c b/kernel/timer.c
index 811e5c391456..5db5a8d26811 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -46,6 +46,9 @@
46#include <asm/timex.h> 46#include <asm/timex.h>
47#include <asm/io.h> 47#include <asm/io.h>
48 48
49#define CREATE_TRACE_POINTS
50#include <trace/events/timer.h>
51
49u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES; 52u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
50 53
51EXPORT_SYMBOL(jiffies_64); 54EXPORT_SYMBOL(jiffies_64);
@@ -521,6 +524,25 @@ static inline void debug_timer_activate(struct timer_list *timer) { }
521static inline void debug_timer_deactivate(struct timer_list *timer) { } 524static inline void debug_timer_deactivate(struct timer_list *timer) { }
522#endif 525#endif
523 526
527static inline void debug_init(struct timer_list *timer)
528{
529 debug_timer_init(timer);
530 trace_timer_init(timer);
531}
532
533static inline void
534debug_activate(struct timer_list *timer, unsigned long expires)
535{
536 debug_timer_activate(timer);
537 trace_timer_start(timer, expires);
538}
539
540static inline void debug_deactivate(struct timer_list *timer)
541{
542 debug_timer_deactivate(timer);
543 trace_timer_cancel(timer);
544}
545
524static void __init_timer(struct timer_list *timer, 546static void __init_timer(struct timer_list *timer,
525 const char *name, 547 const char *name,
526 struct lock_class_key *key) 548 struct lock_class_key *key)
@@ -549,7 +571,7 @@ void init_timer_key(struct timer_list *timer,
549 const char *name, 571 const char *name,
550 struct lock_class_key *key) 572 struct lock_class_key *key)
551{ 573{
552 debug_timer_init(timer); 574 debug_init(timer);
553 __init_timer(timer, name, key); 575 __init_timer(timer, name, key);
554} 576}
555EXPORT_SYMBOL(init_timer_key); 577EXPORT_SYMBOL(init_timer_key);
@@ -568,7 +590,7 @@ static inline void detach_timer(struct timer_list *timer,
568{ 590{
569 struct list_head *entry = &timer->entry; 591 struct list_head *entry = &timer->entry;
570 592
571 debug_timer_deactivate(timer); 593 debug_deactivate(timer);
572 594
573 __list_del(entry->prev, entry->next); 595 __list_del(entry->prev, entry->next);
574 if (clear_pending) 596 if (clear_pending)
@@ -632,7 +654,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires,
632 goto out_unlock; 654 goto out_unlock;
633 } 655 }
634 656
635 debug_timer_activate(timer); 657 debug_activate(timer, expires);
636 658
637 new_base = __get_cpu_var(tvec_bases); 659 new_base = __get_cpu_var(tvec_bases);
638 660
@@ -787,7 +809,7 @@ void add_timer_on(struct timer_list *timer, int cpu)
787 BUG_ON(timer_pending(timer) || !timer->function); 809 BUG_ON(timer_pending(timer) || !timer->function);
788 spin_lock_irqsave(&base->lock, flags); 810 spin_lock_irqsave(&base->lock, flags);
789 timer_set_base(timer, base); 811 timer_set_base(timer, base);
790 debug_timer_activate(timer); 812 debug_activate(timer, timer->expires);
791 if (time_before(timer->expires, base->next_timer) && 813 if (time_before(timer->expires, base->next_timer) &&
792 !tbase_get_deferrable(timer->base)) 814 !tbase_get_deferrable(timer->base))
793 base->next_timer = timer->expires; 815 base->next_timer = timer->expires;
@@ -1000,7 +1022,9 @@ static inline void __run_timers(struct tvec_base *base)
1000 */ 1022 */
1001 lock_map_acquire(&lockdep_map); 1023 lock_map_acquire(&lockdep_map);
1002 1024
1025 trace_timer_expire_entry(timer);
1003 fn(data); 1026 fn(data);
1027 trace_timer_expire_exit(timer);
1004 1028
1005 lock_map_release(&lockdep_map); 1029 lock_map_release(&lockdep_map);
1006 1030