Skip to content

Commit 1929def

Browse files
Jiri OlsaIngo Molnar
authored andcommitted
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>
1 parent dc63398 commit 1929def

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/events/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7818,6 +7818,7 @@ inherit_event(struct perf_event *parent_event,
78187818
struct perf_event *group_leader,
78197819
struct perf_event_context *child_ctx)
78207820
{
7821+
enum perf_event_active_state parent_state = parent_event->state;
78217822
struct perf_event *child_event;
78227823
unsigned long flags;
78237824

@@ -7851,7 +7852,7 @@ inherit_event(struct perf_event *parent_event,
78517852
* not its attr.disabled bit. We hold the parent's mutex,
78527853
* so we won't race with perf_event_{en, dis}able_family.
78537854
*/
7854-
if (parent_event->state >= PERF_EVENT_STATE_INACTIVE)
7855+
if (parent_state >= PERF_EVENT_STATE_INACTIVE)
78557856
child_event->state = PERF_EVENT_STATE_INACTIVE;
78567857
else
78577858
child_event->state = PERF_EVENT_STATE_OFF;

0 commit comments

Comments
 (0)