diff options
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r-- | kernel/perf_event.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 1f38270f08c7..d27746bd3a06 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -3268,6 +3268,9 @@ static void perf_event_task_output(struct perf_event *event, | |||
3268 | 3268 | ||
3269 | static int perf_event_task_match(struct perf_event *event) | 3269 | static int perf_event_task_match(struct perf_event *event) |
3270 | { | 3270 | { |
3271 | if (event->state != PERF_EVENT_STATE_ACTIVE) | ||
3272 | return 0; | ||
3273 | |||
3271 | if (event->cpu != -1 && event->cpu != smp_processor_id()) | 3274 | if (event->cpu != -1 && event->cpu != smp_processor_id()) |
3272 | return 0; | 3275 | return 0; |
3273 | 3276 | ||
@@ -3377,6 +3380,9 @@ static void perf_event_comm_output(struct perf_event *event, | |||
3377 | 3380 | ||
3378 | static int perf_event_comm_match(struct perf_event *event) | 3381 | static int perf_event_comm_match(struct perf_event *event) |
3379 | { | 3382 | { |
3383 | if (event->state != PERF_EVENT_STATE_ACTIVE) | ||
3384 | return 0; | ||
3385 | |||
3380 | if (event->cpu != -1 && event->cpu != smp_processor_id()) | 3386 | if (event->cpu != -1 && event->cpu != smp_processor_id()) |
3381 | return 0; | 3387 | return 0; |
3382 | 3388 | ||
@@ -3494,6 +3500,9 @@ static void perf_event_mmap_output(struct perf_event *event, | |||
3494 | static int perf_event_mmap_match(struct perf_event *event, | 3500 | static int perf_event_mmap_match(struct perf_event *event, |
3495 | struct perf_mmap_event *mmap_event) | 3501 | struct perf_mmap_event *mmap_event) |
3496 | { | 3502 | { |
3503 | if (event->state != PERF_EVENT_STATE_ACTIVE) | ||
3504 | return 0; | ||
3505 | |||
3497 | if (event->cpu != -1 && event->cpu != smp_processor_id()) | 3506 | if (event->cpu != -1 && event->cpu != smp_processor_id()) |
3498 | return 0; | 3507 | return 0; |
3499 | 3508 | ||
@@ -5148,7 +5157,7 @@ int perf_event_init_task(struct task_struct *child) | |||
5148 | GFP_KERNEL); | 5157 | GFP_KERNEL); |
5149 | if (!child_ctx) { | 5158 | if (!child_ctx) { |
5150 | ret = -ENOMEM; | 5159 | ret = -ENOMEM; |
5151 | goto exit; | 5160 | break; |
5152 | } | 5161 | } |
5153 | 5162 | ||
5154 | __perf_event_init_context(child_ctx, child); | 5163 | __perf_event_init_context(child_ctx, child); |
@@ -5164,7 +5173,7 @@ int perf_event_init_task(struct task_struct *child) | |||
5164 | } | 5173 | } |
5165 | } | 5174 | } |
5166 | 5175 | ||
5167 | if (inherited_all) { | 5176 | if (child_ctx && inherited_all) { |
5168 | /* | 5177 | /* |
5169 | * Mark the child context as a clone of the parent | 5178 | * Mark the child context as a clone of the parent |
5170 | * context, or of whatever the parent is a clone of. | 5179 | * context, or of whatever the parent is a clone of. |
@@ -5184,7 +5193,6 @@ int perf_event_init_task(struct task_struct *child) | |||
5184 | get_ctx(child_ctx->parent_ctx); | 5193 | get_ctx(child_ctx->parent_ctx); |
5185 | } | 5194 | } |
5186 | 5195 | ||
5187 | exit: | ||
5188 | mutex_unlock(&parent_ctx->mutex); | 5196 | mutex_unlock(&parent_ctx->mutex); |
5189 | 5197 | ||
5190 | perf_unpin_context(parent_ctx); | 5198 | perf_unpin_context(parent_ctx); |