Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 199121
b: refs/heads/master
c: 0f13930
h: refs/heads/master
i:
  199119: eaae6ef
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed May 21, 2010
1 parent 6ab4926 commit 8a84c69
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1c024eca51fdc965290acf342ae16a476c2189d0
refs/heads/master: 0f139300c9057c16b5833a4636b715b104fe0baa
19 changes: 19 additions & 0 deletions trunk/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -4920,6 +4920,13 @@ static int perf_event_set_output(struct perf_event *event, int output_fd)
int fput_needed = 0;
int ret = -EINVAL;

/*
* Don't allow output of inherited per-task events. This would
* create performance issues due to cross cpu access.
*/
if (event->cpu == -1 && event->attr.inherit)
return -EINVAL;

if (!output_fd)
goto set;

Expand All @@ -4940,6 +4947,18 @@ static int perf_event_set_output(struct perf_event *event, int output_fd)
if (event->data)
goto out;

/*
* Don't allow cross-cpu buffers
*/
if (output_event->cpu != event->cpu)
goto out;

/*
* If its not a per-cpu buffer, it must be the same task.
*/
if (output_event->cpu == -1 && output_event->ctx != event->ctx)
goto out;

atomic_long_inc(&output_file->f_count);

set:
Expand Down

0 comments on commit 8a84c69

Please sign in to comment.