diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-10-14 17:57:23 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-10-18 19:58:58 +0200 |
commit | 82cd6def9806dcb6a325fb6abbc1d61388a15f6a (patch) | |
tree | 569ce440f8a0619adb8c3791d6b68eecdb2fd29c /include/linux/perf_event.h | |
parent | 8b92538d84e50062560ba33adbaed7887b6e4a42 (diff) | |
download | kernel_goldelico_gta04-82cd6def9806dcb6a325fb6abbc1d61388a15f6a.zip kernel_goldelico_gta04-82cd6def9806dcb6a325fb6abbc1d61388a15f6a.tar.gz kernel_goldelico_gta04-82cd6def9806dcb6a325fb6abbc1d61388a15f6a.tar.bz2 |
perf: Use jump_labels to optimize the scheduler hooks
Trades a call + conditional + ret for an unconditional jmp.
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20101014203625.501657727@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r-- | include/linux/perf_event.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 97965fa..7f0e7f5 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -487,6 +487,7 @@ struct perf_guest_info_callbacks { #include <linux/ftrace.h> #include <linux/cpu.h> #include <linux/irq_work.h> +#include <linux/jump_label_ref.h> #include <asm/atomic.h> #include <asm/local.h> @@ -895,8 +896,30 @@ extern void perf_pmu_unregister(struct pmu *pmu); extern int perf_num_counters(void); extern const char *perf_pmu_name(void); -extern void perf_event_task_sched_in(struct task_struct *task); -extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next); +extern void __perf_event_task_sched_in(struct task_struct *task); +extern void __perf_event_task_sched_out(struct task_struct *task, struct task_struct *next); + +extern atomic_t perf_task_events; + +static inline void perf_event_task_sched_in(struct task_struct *task) +{ + JUMP_LABEL(&perf_task_events, have_events); + return; + +have_events: + __perf_event_task_sched_in(task); +} + +static inline +void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next) +{ + JUMP_LABEL(&perf_task_events, have_events); + return; + +have_events: + __perf_event_task_sched_out(task, next); +} + extern int perf_event_init_task(struct task_struct *child); extern void perf_event_exit_task(struct task_struct *child); extern void perf_event_free_task(struct task_struct *task); |