diff options
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r-- | kernel/perf_event.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 193b1900e64f..ed253aa24ba4 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -820,16 +820,8 @@ list_add_event(struct perf_event *event, struct perf_event_context *ctx) | |||
820 | list_add_tail(&event->group_entry, list); | 820 | list_add_tail(&event->group_entry, list); |
821 | } | 821 | } |
822 | 822 | ||
823 | if (is_cgroup_event(event)) { | 823 | if (is_cgroup_event(event)) |
824 | ctx->nr_cgroups++; | 824 | ctx->nr_cgroups++; |
825 | /* | ||
826 | * one more event: | ||
827 | * - that has cgroup constraint on event->cpu | ||
828 | * - that may need work on context switch | ||
829 | */ | ||
830 | atomic_inc(&per_cpu(perf_cgroup_events, event->cpu)); | ||
831 | jump_label_inc(&perf_sched_events); | ||
832 | } | ||
833 | 825 | ||
834 | list_add_rcu(&event->event_entry, &ctx->event_list); | 826 | list_add_rcu(&event->event_entry, &ctx->event_list); |
835 | if (!ctx->nr_events) | 827 | if (!ctx->nr_events) |
@@ -957,11 +949,8 @@ list_del_event(struct perf_event *event, struct perf_event_context *ctx) | |||
957 | 949 | ||
958 | event->attach_state &= ~PERF_ATTACH_CONTEXT; | 950 | event->attach_state &= ~PERF_ATTACH_CONTEXT; |
959 | 951 | ||
960 | if (is_cgroup_event(event)) { | 952 | if (is_cgroup_event(event)) |
961 | ctx->nr_cgroups--; | 953 | ctx->nr_cgroups--; |
962 | atomic_dec(&per_cpu(perf_cgroup_events, event->cpu)); | ||
963 | jump_label_dec(&perf_sched_events); | ||
964 | } | ||
965 | 954 | ||
966 | ctx->nr_events--; | 955 | ctx->nr_events--; |
967 | if (event->attr.inherit_stat) | 956 | if (event->attr.inherit_stat) |
@@ -2903,6 +2892,10 @@ static void free_event(struct perf_event *event) | |||
2903 | atomic_dec(&nr_task_events); | 2892 | atomic_dec(&nr_task_events); |
2904 | if (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN) | 2893 | if (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN) |
2905 | put_callchain_buffers(); | 2894 | put_callchain_buffers(); |
2895 | if (is_cgroup_event(event)) { | ||
2896 | atomic_dec(&per_cpu(perf_cgroup_events, event->cpu)); | ||
2897 | jump_label_dec(&perf_sched_events); | ||
2898 | } | ||
2906 | } | 2899 | } |
2907 | 2900 | ||
2908 | if (event->buffer) { | 2901 | if (event->buffer) { |
@@ -6478,6 +6471,13 @@ SYSCALL_DEFINE5(perf_event_open, | |||
6478 | err = perf_cgroup_connect(pid, event, &attr, group_leader); | 6471 | err = perf_cgroup_connect(pid, event, &attr, group_leader); |
6479 | if (err) | 6472 | if (err) |
6480 | goto err_alloc; | 6473 | goto err_alloc; |
6474 | /* | ||
6475 | * one more event: | ||
6476 | * - that has cgroup constraint on event->cpu | ||
6477 | * - that may need work on context switch | ||
6478 | */ | ||
6479 | atomic_inc(&per_cpu(perf_cgroup_events, event->cpu)); | ||
6480 | jump_label_inc(&perf_sched_events); | ||
6481 | } | 6481 | } |
6482 | 6482 | ||
6483 | /* | 6483 | /* |