提交 1929def9 编写于 作者: J Jiri Olsa 提交者: Ingo Molnar

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: NJiri Olsa <jolsa@kernel.org>
Signed-off-by: NPeter 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.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
上级 dc633982
...@@ -7818,6 +7818,7 @@ inherit_event(struct perf_event *parent_event, ...@@ -7818,6 +7818,7 @@ inherit_event(struct perf_event *parent_event,
struct perf_event *group_leader, struct perf_event *group_leader,
struct perf_event_context *child_ctx) struct perf_event_context *child_ctx)
{ {
enum perf_event_active_state parent_state = parent_event->state;
struct perf_event *child_event; struct perf_event *child_event;
unsigned long flags; unsigned long flags;
...@@ -7851,7 +7852,7 @@ inherit_event(struct perf_event *parent_event, ...@@ -7851,7 +7852,7 @@ inherit_event(struct perf_event *parent_event,
* not its attr.disabled bit. We hold the parent's mutex, * not its attr.disabled bit. We hold the parent's mutex,
* so we won't race with perf_event_{en, dis}able_family. * so we won't race with perf_event_{en, dis}able_family.
*/ */
if (parent_event->state >= PERF_EVENT_STATE_INACTIVE) if (parent_state >= PERF_EVENT_STATE_INACTIVE)
child_event->state = PERF_EVENT_STATE_INACTIVE; child_event->state = PERF_EVENT_STATE_INACTIVE;
else else
child_event->state = PERF_EVENT_STATE_OFF; child_event->state = PERF_EVENT_STATE_OFF;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册