Skip to content

Commit 5f20190

Browse files
heicarstKAGA-KOKO
authored andcommitted
hrtimer: move timer stats helper functions to hrtimer.c
There is no reason to make timer_stats_hrtimer_set_start_info and friends visible to the rest of the kernel. So move all of them to hrtimer.c. Also make timer_stats_hrtimer_set_start_info a static inline function so it gets inlined and we avoid another function call. Based on a patch by Thomas Gleixner. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> LKML-Reference: <20091210095629.GC4144@osiris.boeblingen.de.ibm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 41d2e49 commit 5f20190

2 files changed

Lines changed: 20 additions & 47 deletions

File tree

‎include/linux/hrtimer.h‎

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -440,47 +440,4 @@ extern u64 ktime_divns(const ktime_t kt, s64 div);
440440
/* Show pending timers: */
441441
extern void sysrq_timer_list_show(void);
442442

443-
/*
444-
* Timer-statistics info:
445-
*/
446-
#ifdef CONFIG_TIMER_STATS
447-
448-
extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
449-
void *timerf, char *comm,
450-
unsigned int timer_flag);
451-
452-
static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
453-
{
454-
if (likely(!timer_stats_active))
455-
return;
456-
timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
457-
timer->function, timer->start_comm, 0);
458-
}
459-
460-
extern void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer,
461-
void *addr);
462-
463-
static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
464-
{
465-
__timer_stats_hrtimer_set_start_info(timer, __builtin_return_address(0));
466-
}
467-
468-
static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer)
469-
{
470-
timer->start_site = NULL;
471-
}
472-
#else
473-
static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
474-
{
475-
}
476-
477-
static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
478-
{
479-
}
480-
481-
static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer)
482-
{
483-
}
484-
#endif
485-
486443
#endif

‎kernel/hrtimer.c‎

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -756,17 +756,33 @@ static inline void hrtimer_init_timer_hres(struct hrtimer *timer) { }
756756

757757
#endif /* CONFIG_HIGH_RES_TIMERS */
758758

759-
#ifdef CONFIG_TIMER_STATS
760-
void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer, void *addr)
759+
static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
761760
{
761+
#ifdef CONFIG_TIMER_STATS
762762
if (timer->start_site)
763763
return;
764-
765-
timer->start_site = addr;
764+
timer->start_site = __builtin_return_address(0);
766765
memcpy(timer->start_comm, current->comm, TASK_COMM_LEN);
767766
timer->start_pid = current->pid;
767+
#endif
768768
}
769+
770+
static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer)
771+
{
772+
#ifdef CONFIG_TIMER_STATS
773+
timer->start_site = NULL;
769774
#endif
775+
}
776+
777+
static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
778+
{
779+
#ifdef CONFIG_TIMER_STATS
780+
if (likely(!timer_stats_active))
781+
return;
782+
timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
783+
timer->function, timer->start_comm, 0);
784+
#endif
785+
}
770786

771787
/*
772788
* Counterpart to lock_hrtimer_base above:

0 commit comments

Comments
 (0)