summaryrefslogtreecommitdiffstats
path: root/kernel/events
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2017-08-25 11:01:05 +0200
committerIngo Molnar <mingo@kernel.org>2017-08-25 11:01:05 +0200
commit290d9bf2811bd83ae907232176d75690c0f7d82b (patch)
treea3b72364248c4bc1b2bf6ed1958ea4e6d6a1564e /kernel/events
parentc7f4f994dea2e6a513e63f063f6c92202b7c1f3f (diff)
parent64aee2a965cf2954a038b5522f11d2cd2f0f8f3e (diff)
downloadlinux-290d9bf2811bd83ae907232176d75690c0f7d82b.tar.bz2
Merge branch 'perf/urgent' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/events')
-rw-r--r--kernel/events/core.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index d704e23914bf..1ac5015bab04 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10041,28 +10041,27 @@ SYSCALL_DEFINE5(perf_event_open,
goto err_context;
/*
- * Do not allow to attach to a group in a different
- * task or CPU context:
+ * Make sure we're both events for the same CPU;
+ * grouping events for different CPUs is broken; since
+ * you can never concurrently schedule them anyhow.
*/
- if (move_group) {
- /*
- * Make sure we're both on the same task, or both
- * per-cpu events.
- */
- if (group_leader->ctx->task != ctx->task)
- goto err_context;
+ if (group_leader->cpu != event->cpu)
+ goto err_context;
- /*
- * Make sure we're both events for the same CPU;
- * grouping events for different CPUs is broken; since
- * you can never concurrently schedule them anyhow.
- */
- if (group_leader->cpu != event->cpu)
- goto err_context;
- } else {
- if (group_leader->ctx != ctx)
- goto err_context;
- }
+ /*
+ * Make sure we're both on the same task, or both
+ * per-CPU events.
+ */
+ if (group_leader->ctx->task != ctx->task)
+ goto err_context;
+
+ /*
+ * Do not allow to attach to a group in a different task
+ * or CPU context. If we're moving SW events, we'll fix
+ * this up later, so allow that.
+ */
+ if (!move_group && group_leader->ctx != ctx)
+ goto err_context;
/*
* Only a group leader can be exclusive or pinned