diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-03-03 05:31:20 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-03-04 05:32:52 -0500 |
commit | 08309379b7083a9ceec0f9bb96a629058fb623c4 (patch) | |
tree | c2863e7e97922e3e3bb3f97ca281b0ed6bf16aa0 /kernel/perf_event.c | |
parent | 2d0f25201ee210a0666ec9c41538ba05a07f8bc6 (diff) |
perf: Fix cgroup vs jump_label problem
Li Zefan reported that the jump label code sleeps and we're calling it
under a spinlock, *fail* ;-)
Reported-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
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 | /* |