diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-10-14 16:32:45 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-10-18 13:58:59 -0400 |
commit | 7e54a5a0b655734326dc78c2b5efc1eb35497bb6 (patch) | |
tree | 71346dfdb01ef387ad1aaaccbf72b3127814ce92 /include/linux/perf_event.h | |
parent | 82cd6def9806dcb6a325fb6abbc1d61388a15f6a (diff) |
perf: Optimize sw events
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r-- | include/linux/perf_event.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 7f0e7f52af8b..3b80cbf509ef 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -1012,18 +1012,20 @@ static inline void perf_fetch_caller_regs(struct pt_regs *regs) | |||
1012 | perf_arch_fetch_caller_regs(regs, CALLER_ADDR0); | 1012 | perf_arch_fetch_caller_regs(regs, CALLER_ADDR0); |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | static inline void | 1015 | static __always_inline void |
1016 | perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr) | 1016 | perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr) |
1017 | { | 1017 | { |
1018 | if (atomic_read(&perf_swevent_enabled[event_id])) { | 1018 | struct pt_regs hot_regs; |
1019 | struct pt_regs hot_regs; | 1019 | |
1020 | 1020 | JUMP_LABEL(&perf_swevent_enabled[event_id], have_event); | |
1021 | if (!regs) { | 1021 | return; |
1022 | perf_fetch_caller_regs(&hot_regs); | 1022 | |
1023 | regs = &hot_regs; | 1023 | have_event: |
1024 | } | 1024 | if (!regs) { |
1025 | __perf_sw_event(event_id, nr, nmi, regs, addr); | 1025 | perf_fetch_caller_regs(&hot_regs); |
1026 | regs = &hot_regs; | ||
1026 | } | 1027 | } |
1028 | __perf_sw_event(event_id, nr, nmi, regs, addr); | ||
1027 | } | 1029 | } |
1028 | 1030 | ||
1029 | extern void perf_event_mmap(struct vm_area_struct *vma); | 1031 | extern void perf_event_mmap(struct vm_area_struct *vma); |