From: Zhou Chengming <zhouchengming1@huawei.com>
To: <mingo@redhat.com>, <peterz@infradead.org>
Cc: <linux-kernel@vger.kernel.org>, <acme@kernel.org>,
<alexander.shishkin@linux.intel.com>, <guohanjun@huawei.com>,
<zhouchengming1@huawei.com>
Subject: [PATCH] perf/core: make sure group events are for the same cpu
Date: Sat, 17 Jun 2017 15:42:12 +0800 [thread overview]
Message-ID: <1497685332-122353-1-git-send-email-zhouchengming1@huawei.com> (raw)
The else branch are broken for taskctx: two events can on the same
taskctx, but on different cpu. This patch fix it, we don't need to
check move_group. We first make sure we're on the same task, or both
per-cpu events, and then make sure we're events for the same cpu.
Signed-off-by: Zhou Chengming <zhouchengming1@huawei.com>
---
kernel/events/core.c | 31 +++++++++++--------------------
1 file changed, 11 insertions(+), 20 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6c4e523..59270bd 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10010,28 +10010,19 @@ static int perf_event_set_clock(struct perf_event *event, clockid_t clk_id)
goto err_context;
/*
- * Do not allow to attach to a group in a different
- * task or CPU context:
+ * Make sure we're both on the same task, or both
+ * per-cpu events.
*/
- 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->ctx->task != ctx->task)
+ 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 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;
/*
* Only a group leader can be exclusive or pinned
--
1.8.3.1
next reply other threads:[~2017-06-17 7:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-17 7:42 Zhou Chengming [this message]
2017-06-20 13:08 ` Alexander Shishkin
2017-06-21 6:55 ` zhouchengming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1497685332-122353-1-git-send-email-zhouchengming1@huawei.com \
--to=zhouchengming1@huawei.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=guohanjun@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®