lkml.org 
[lkml]   [2010]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/5] perf: Disallow mmap() on per-task inherited events
Since we now have working per-task-per-cpu events for a while,
disallow mmap() on per-task inherited events. Those things were
a performance problem anyway, and doing away with it allows
us to optimize the buffer somewhat by assuming there is only a single
writer.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
kernel/perf_event.c | 8 ++++++++
1 file changed, 8 insertions(+)

Index: linux-2.6/kernel/perf_event.c
===================================================================
--- linux-2.6.orig/kernel/perf_event.c
+++ linux-2.6/kernel/perf_event.c
@@ -2580,6 +2580,14 @@ static int perf_mmap(struct file *file,
long user_extra, extra;
int ret = 0;

+ /*
+ * Don't allow mmap() of inherited per-task counters. This would
+ * create a performance issue due to all children writing to the
+ * same buffer.
+ */
+ if (event->cpu == -1 && event->attr.inherit)
+ return -EINVAL;
+
if (!(vma->vm_flags & VM_SHARED))
return -EINVAL;




\
 
 \ /
  Last update: 2010-05-18 15:51    [W:0.083 / U:1.092 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site