aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/events
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2014-09-12 07:18:27 -0400
committerIngo Molnar <mingo@kernel.org>2014-09-24 08:48:12 -0400
commit1929def9e609d1a8cdb1626d85eda3da66921a7d (patch)
treeb564aab4275cbf01768860718f83691f05bf9af9 /kernel/events
parentdc633982ff3f4fd74cdc11b5a6ae53d39a0b2451 (diff)
perf: Fix child event initial state setup
Currently we initialize the child event based on the original parent state. This is wrong, because the original parent event (and its state) is not related to current fork and also could be already gone. We need to initialize the child state based on the immediate parent event state. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Stephane Eranian <eranian@google.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: http://lkml.kernel.org/r/1410520708-19275-2-git-send-email-jolsa@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/events')
-rw-r--r--kernel/events/core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 15e58d4ea035..132524c8b340 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7818,6 +7818,7 @@ inherit_event(struct perf_event *parent_event,
7818 struct perf_event *group_leader, 7818 struct perf_event *group_leader,
7819 struct perf_event_context *child_ctx) 7819 struct perf_event_context *child_ctx)
7820{ 7820{
7821 enum perf_event_active_state parent_state = parent_event->state;
7821 struct perf_event *child_event; 7822 struct perf_event *child_event;
7822 unsigned long flags; 7823 unsigned long flags;
7823 7824
@@ -7851,7 +7852,7 @@ inherit_event(struct perf_event *parent_event,
7851 * not its attr.disabled bit. We hold the parent's mutex, 7852 * not its attr.disabled bit. We hold the parent's mutex,
7852 * so we won't race with perf_event_{en, dis}able_family. 7853 * so we won't race with perf_event_{en, dis}able_family.
7853 */ 7854 */
7854 if (parent_event->state >= PERF_EVENT_STATE_INACTIVE) 7855 if (parent_state >= PERF_EVENT_STATE_INACTIVE)
7855 child_event->state = PERF_EVENT_STATE_INACTIVE; 7856 child_event->state = PERF_EVENT_STATE_INACTIVE;
7856 else 7857 else
7857 child_event->state = PERF_EVENT_STATE_OFF; 7858 child_event->state = PERF_EVENT_STATE_OFF;