[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-08309379b7083a9ceec0f9bb96a629058fb623c4@git.kernel.org>
Date: Fri, 4 Mar 2011 11:52:32 GMT
From: tip-bot for Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
lizf@...fujitsu.com, a.p.zijlstra@...llo.nl, tglx@...utronix.de,
mingo@...e.hu
Subject: [tip:perf/core] perf: Fix cgroup vs jump_label problem
Commit-ID: 08309379b7083a9ceec0f9bb96a629058fb623c4
Gitweb: http://git.kernel.org/tip/08309379b7083a9ceec0f9bb96a629058fb623c4
Author: Peter Zijlstra <a.p.zijlstra@...llo.nl>
AuthorDate: Thu, 3 Mar 2011 11:31:20 +0100
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Fri, 4 Mar 2011 11:32:52 +0100
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@...fujitsu.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
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 193b190..ed253aa 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)
list_add_tail(&event->group_entry, list);
}
- if (is_cgroup_event(event)) {
+ if (is_cgroup_event(event))
ctx->nr_cgroups++;
- /*
- * one more event:
- * - that has cgroup constraint on event->cpu
- * - that may need work on context switch
- */
- atomic_inc(&per_cpu(perf_cgroup_events, event->cpu));
- jump_label_inc(&perf_sched_events);
- }
list_add_rcu(&event->event_entry, &ctx->event_list);
if (!ctx->nr_events)
@@ -957,11 +949,8 @@ list_del_event(struct perf_event *event, struct perf_event_context *ctx)
event->attach_state &= ~PERF_ATTACH_CONTEXT;
- if (is_cgroup_event(event)) {
+ if (is_cgroup_event(event))
ctx->nr_cgroups--;
- atomic_dec(&per_cpu(perf_cgroup_events, event->cpu));
- jump_label_dec(&perf_sched_events);
- }
ctx->nr_events--;
if (event->attr.inherit_stat)
@@ -2903,6 +2892,10 @@ static void free_event(struct perf_event *event)
atomic_dec(&nr_task_events);
if (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN)
put_callchain_buffers();
+ if (is_cgroup_event(event)) {
+ atomic_dec(&per_cpu(perf_cgroup_events, event->cpu));
+ jump_label_dec(&perf_sched_events);
+ }
}
if (event->buffer) {
@@ -6478,6 +6471,13 @@ SYSCALL_DEFINE5(perf_event_open,
err = perf_cgroup_connect(pid, event, &attr, group_leader);
if (err)
goto err_alloc;
+ /*
+ * one more event:
+ * - that has cgroup constraint on event->cpu
+ * - that may need work on context switch
+ */
+ atomic_inc(&per_cpu(perf_cgroup_events, event->cpu));
+ jump_label_inc(&perf_sched_events);
}
/*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists