aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/events
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-02-02 10:27:52 -0500
committerOleg Nesterov <oleg@redhat.com>2013-02-08 12:28:02 -0500
commitf22c1bb6b4706be3502b378cb14564449b15f983 (patch)
treeac7d09e3d42f4ab77cac56b9cb7fba2d4bcabf06 /kernel/events
parent1b47aefd9b6bd439a4be43c47acd22987ac22db8 (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 'kernel/events')
-rw-r--r--kernel/events/core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 301079d06f24..e2d4323c6ae6 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6162,11 +6162,14 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
6162 6162
6163 if (task) { 6163 if (task) {
6164 event->attach_state = PERF_ATTACH_TASK; 6164 event->attach_state = PERF_ATTACH_TASK;
6165
6166 if (attr->type == PERF_TYPE_TRACEPOINT)
6167 event->hw.tp_target = task;
6165#ifdef CONFIG_HAVE_HW_BREAKPOINT 6168#ifdef CONFIG_HAVE_HW_BREAKPOINT
6166 /* 6169 /*
6167 * hw_breakpoint is a bit difficult here.. 6170 * hw_breakpoint is a bit difficult here..
6168 */ 6171 */
6169 if (attr->type == PERF_TYPE_BREAKPOINT) 6172 else if (attr->type == PERF_TYPE_BREAKPOINT)
6170 event->hw.bp_target = task; 6173 event->hw.bp_target = task;
6171#endif 6174#endif
6172 } 6175 }