diff options
author | Oleg Nesterov <oleg@redhat.com> | 2013-02-02 10:27:52 -0500 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2013-02-08 12:28:02 -0500 |
commit | f22c1bb6b4706be3502b378cb14564449b15f983 (patch) | |
tree | ac7d09e3d42f4ab77cac56b9cb7fba2d4bcabf06 /include/linux/perf_event.h | |
parent | 1b47aefd9b6bd439a4be43c47acd22987ac22db8 (diff) |
perf: Introduce hw_perf_event->tp_target and ->tp_list
sys_perf_event_open()->perf_init_event(event) is called before
find_get_context(event), this means that event->ctx == NULL when
class->reg(TRACE_REG_PERF_REGISTER/OPEN) is called and thus it
can't know if this event is per-task or system-wide.
This patch adds hw_perf_event->tp_target for PERF_TYPE_TRACEPOINT,
this is analogous to PERF_TYPE_BREAKPOINT/bp_target we already have.
The patch also moves ->bp_target up so that it can overlap with the
new member, this can help the compiler to generate the better code.
trace_uprobe_register() will use it for prefiltering to avoid the
unnecessary breakpoints in mm's we do not want to trace.
->tp_target doesn't have its own reference, but we can rely on the
fact that either sys_perf_event_open() holds a reference, or it is
equal to event->ctx->task. So this pointer is always valid until
free_event().
Also add the "struct list_head tp_list" into this union. It is not
strictly necessary, but it can simplify the next changes and we can
add it for free.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r-- | include/linux/perf_event.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 42adf012145d..e47ee462c2f2 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -135,16 +135,21 @@ struct hw_perf_event { | |||
135 | struct { /* software */ | 135 | struct { /* software */ |
136 | struct hrtimer hrtimer; | 136 | struct hrtimer hrtimer; |
137 | }; | 137 | }; |
138 | struct { /* tracepoint */ | ||
139 | struct task_struct *tp_target; | ||
140 | /* for tp_event->class */ | ||
141 | struct list_head tp_list; | ||
142 | }; | ||
138 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | 143 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
139 | struct { /* breakpoint */ | 144 | struct { /* breakpoint */ |
140 | struct arch_hw_breakpoint info; | ||
141 | struct list_head bp_list; | ||
142 | /* | 145 | /* |
143 | * Crufty hack to avoid the chicken and egg | 146 | * Crufty hack to avoid the chicken and egg |
144 | * problem hw_breakpoint has with context | 147 | * problem hw_breakpoint has with context |
145 | * creation and event initalization. | 148 | * creation and event initalization. |
146 | */ | 149 | */ |
147 | struct task_struct *bp_target; | 150 | struct task_struct *bp_target; |
151 | struct arch_hw_breakpoint info; | ||
152 | struct list_head bp_list; | ||
148 | }; | 153 | }; |
149 | #endif | 154 | #endif |
150 | }; | 155 | }; |