Lines Matching refs:timer
102 static inline void timer_set_deferrable(struct timer_list *timer) in timer_set_deferrable() argument
104 timer->base = ((struct tvec_base *)((unsigned long)(timer->base) | in timer_set_deferrable()
109 timer_set_base(struct timer_list *timer, struct tvec_base *new_base) in timer_set_base() argument
111 timer->base = (struct tvec_base *)((unsigned long)(new_base) | in timer_set_base()
112 tbase_get_deferrable(timer->base)); in timer_set_base()
317 struct timer_list *timer) in set_running_timer() argument
320 base->running_timer = timer; in set_running_timer()
324 static void internal_add_timer(struct tvec_base *base, struct timer_list *timer) in internal_add_timer() argument
326 unsigned long expires = timer->expires; in internal_add_timer()
363 list_add_tail(&timer->entry, vec); in internal_add_timer()
367 void __timer_stats_timer_set_start_info(struct timer_list *timer, void *addr) in __timer_stats_timer_set_start_info() argument
369 if (timer->start_site) in __timer_stats_timer_set_start_info()
372 timer->start_site = addr; in __timer_stats_timer_set_start_info()
373 memcpy(timer->start_comm, current->comm, TASK_COMM_LEN); in __timer_stats_timer_set_start_info()
374 timer->start_pid = current->pid; in __timer_stats_timer_set_start_info()
377 static void timer_stats_account_timer(struct timer_list *timer) in timer_stats_account_timer() argument
381 if (unlikely(tbase_get_deferrable(timer->base))) in timer_stats_account_timer()
384 timer_stats_update_stats(timer, timer->start_pid, timer->start_site, in timer_stats_account_timer()
385 timer->function, timer->start_comm, flag); in timer_stats_account_timer()
389 static void timer_stats_account_timer(struct timer_list *timer) {} in timer_stats_account_timer() argument
402 struct timer_list *timer = addr; in timer_fixup_init() local
406 del_timer_sync(timer); in timer_fixup_init()
407 debug_object_init(timer, &timer_debug_descr); in timer_fixup_init()
421 struct timer_list *timer = addr; in timer_fixup_activate() local
431 if (timer->entry.next == NULL && in timer_fixup_activate()
432 timer->entry.prev == TIMER_ENTRY_STATIC) { in timer_fixup_activate()
433 debug_object_init(timer, &timer_debug_descr); in timer_fixup_activate()
434 debug_object_activate(timer, &timer_debug_descr); in timer_fixup_activate()
455 struct timer_list *timer = addr; in timer_fixup_free() local
459 del_timer_sync(timer); in timer_fixup_free()
460 debug_object_free(timer, &timer_debug_descr); in timer_fixup_free()
474 static inline void debug_timer_init(struct timer_list *timer) in debug_timer_init() argument
476 debug_object_init(timer, &timer_debug_descr); in debug_timer_init()
479 static inline void debug_timer_activate(struct timer_list *timer) in debug_timer_activate() argument
481 debug_object_activate(timer, &timer_debug_descr); in debug_timer_activate()
484 static inline void debug_timer_deactivate(struct timer_list *timer) in debug_timer_deactivate() argument
486 debug_object_deactivate(timer, &timer_debug_descr); in debug_timer_deactivate()
489 static inline void debug_timer_free(struct timer_list *timer) in debug_timer_free() argument
491 debug_object_free(timer, &timer_debug_descr); in debug_timer_free()
494 static void __init_timer(struct timer_list *timer);
496 void init_timer_on_stack(struct timer_list *timer) in init_timer_on_stack() argument
498 debug_object_init_on_stack(timer, &timer_debug_descr); in init_timer_on_stack()
499 __init_timer(timer); in init_timer_on_stack()
503 void destroy_timer_on_stack(struct timer_list *timer) in destroy_timer_on_stack() argument
505 debug_object_free(timer, &timer_debug_descr); in destroy_timer_on_stack()
510 static inline void debug_timer_init(struct timer_list *timer) { } in debug_timer_init() argument
511 static inline void debug_timer_activate(struct timer_list *timer) { } in debug_timer_activate() argument
512 static inline void debug_timer_deactivate(struct timer_list *timer) { } in debug_timer_deactivate() argument
515 static void __init_timer(struct timer_list *timer) in __init_timer() argument
517 timer->entry.next = NULL; in __init_timer()
518 timer->base = __raw_get_cpu_var(tvec_bases); in __init_timer()
520 timer->start_site = NULL; in __init_timer()
521 timer->start_pid = -1; in __init_timer()
522 memset(timer->start_comm, 0, TASK_COMM_LEN); in __init_timer()
533 void init_timer(struct timer_list *timer) in init_timer() argument
535 debug_timer_init(timer); in init_timer()
536 __init_timer(timer); in init_timer()
540 void init_timer_deferrable(struct timer_list *timer) in init_timer_deferrable() argument
542 init_timer(timer); in init_timer_deferrable()
543 timer_set_deferrable(timer); in init_timer_deferrable()
547 static inline void detach_timer(struct timer_list *timer, in detach_timer() argument
550 struct list_head *entry = &timer->entry; in detach_timer()
552 debug_timer_deactivate(timer); in detach_timer()
572 static struct tvec_base *lock_timer_base(struct timer_list *timer, in lock_timer_base() argument
574 __acquires(timer->base->lock) in lock_timer_base()
579 struct tvec_base *prelock_base = timer->base; in lock_timer_base()
583 if (likely(prelock_base == timer->base)) in lock_timer_base()
592 int __mod_timer(struct timer_list *timer, unsigned long expires) in __mod_timer() argument
598 timer_stats_timer_set_start_info(timer); in __mod_timer()
599 BUG_ON(!timer->function); in __mod_timer()
601 base = lock_timer_base(timer, &flags); in __mod_timer()
603 if (timer_pending(timer)) { in __mod_timer()
604 detach_timer(timer, 0); in __mod_timer()
608 debug_timer_activate(timer); in __mod_timer()
620 if (likely(base->running_timer != timer)) { in __mod_timer()
622 timer_set_base(timer, NULL); in __mod_timer()
626 timer_set_base(timer, base); in __mod_timer()
630 timer->expires = expires; in __mod_timer()
631 internal_add_timer(base, timer); in __mod_timer()
646 void add_timer_on(struct timer_list *timer, int cpu) in add_timer_on() argument
651 timer_stats_timer_set_start_info(timer); in add_timer_on()
652 BUG_ON(timer_pending(timer) || !timer->function); in add_timer_on()
654 timer_set_base(timer, base); in add_timer_on()
655 debug_timer_activate(timer); in add_timer_on()
656 internal_add_timer(base, timer); in add_timer_on()
689 int mod_timer(struct timer_list *timer, unsigned long expires) in mod_timer() argument
691 BUG_ON(!timer->function); in mod_timer()
693 timer_stats_timer_set_start_info(timer); in mod_timer()
699 if (timer->expires == expires && timer_pending(timer)) in mod_timer()
702 return __mod_timer(timer, expires); in mod_timer()
718 int del_timer(struct timer_list *timer) in del_timer() argument
724 timer_stats_timer_clear_start_info(timer); in del_timer()
725 if (timer_pending(timer)) { in del_timer()
726 base = lock_timer_base(timer, &flags); in del_timer()
727 if (timer_pending(timer)) { in del_timer()
728 detach_timer(timer, 1); in del_timer()
749 int try_to_del_timer_sync(struct timer_list *timer) in try_to_del_timer_sync() argument
755 base = lock_timer_base(timer, &flags); in try_to_del_timer_sync()
757 if (base->running_timer == timer) in try_to_del_timer_sync()
761 if (timer_pending(timer)) { in try_to_del_timer_sync()
762 detach_timer(timer, 1); in try_to_del_timer_sync()
790 int del_timer_sync(struct timer_list *timer) in del_timer_sync() argument
793 int ret = try_to_del_timer_sync(timer); in del_timer_sync()
806 struct timer_list *timer, *tmp; in cascade() local
815 list_for_each_entry_safe(timer, tmp, &tv_list, entry) { in cascade()
816 BUG_ON(tbase_get_base(timer->base) != base); in cascade()
817 internal_add_timer(base, timer); in cascade()
834 struct timer_list *timer; in __run_timers() local
856 timer = list_first_entry(head, struct timer_list,entry); in __run_timers()
857 fn = timer->function; in __run_timers()
858 data = timer->data; in __run_timers()
860 timer_stats_account_timer(timer); in __run_timers()
862 set_running_timer(base, timer); in __run_timers()
863 detach_timer(timer, 1); in __run_timers()
1236 struct timer_list timer; in schedule_timeout() local
1270 setup_timer_on_stack(&timer, process_timeout, (unsigned long)current); in schedule_timeout()
1271 __mod_timer(&timer, expire); in schedule_timeout()
1273 del_singleshot_timer_sync(&timer); in schedule_timeout()
1276 destroy_timer_on_stack(&timer); in schedule_timeout()
1474 struct timer_list *timer; in migrate_timer_list() local
1477 timer = list_first_entry(head, struct timer_list, entry); in migrate_timer_list()
1478 detach_timer(timer, 0); in migrate_timer_list()
1479 timer_set_base(timer, new_base); in migrate_timer_list()
1480 internal_add_timer(new_base, timer); in migrate_timer_list()