From 1dd5b618314e0eee9c0f6de9667afcddbf9393bf Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 16 Dec 2009 17:55:54 +0100 Subject: [PATCH] --- yaml --- r: 177469 b: refs/heads/master c: f4c4176f21533e22bcc292030da72bcfa105f5b8 h: refs/heads/master i: 177467: 8ed8a69d9cd16480ce3cff70911265af5b777cdc v: v3 --- [refs] | 2 +- trunk/kernel/perf_event.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 5a164b9e8bca..1a82866adcb9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9b33827de63539c7c3314ddf890fb216e4acf3d8 +refs/heads/master: f4c4176f21533e22bcc292030da72bcfa105f5b8 diff --git a/trunk/kernel/perf_event.c b/trunk/kernel/perf_event.c index 0dd8e5d02c66..2e0aaa34fc7e 100644 --- a/trunk/kernel/perf_event.c +++ b/trunk/kernel/perf_event.c @@ -782,6 +782,9 @@ static void __perf_install_in_context(void *info) add_event_to_ctx(event, ctx); + if (event->cpu != -1 && event->cpu != smp_processor_id()) + goto unlock; + /* * Don't put the event on if it is disabled or if * it is in a group and the group isn't on. @@ -925,6 +928,9 @@ static void __perf_event_enable(void *info) goto unlock; __perf_event_mark_enabled(event, ctx); + if (event->cpu != -1 && event->cpu != smp_processor_id()) + goto unlock; + /* * If the event is in a group and isn't the group leader, * then don't put it on unless the group is on. @@ -1595,10 +1601,7 @@ static struct perf_event_context *find_get_context(pid_t pid, int cpu) unsigned long flags; int err; - /* - * If cpu is not a wildcard then this is a percpu event: - */ - if (cpu != -1) { + if (pid == -1 && cpu != -1) { /* Must be root to operate on a CPU event: */ if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN)) return ERR_PTR(-EACCES);