summaryrefslogtreecommitdiff
path: root/kernel/perf_counter.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-06-05 14:04:55 +0200
committerIngo Molnar <mingo@elte.hu>2009-06-05 14:46:41 +0200
commit089dd79db9264dc0da602bad45d42f1b3e7d1e07 (patch)
tree017b1efd0bc4f3d15b92ed6fae5dfc3d1b164872 /kernel/perf_counter.c
parentf7b6eb3fa07269da20dbbde8ba37a0273fdbd9c9 (diff)
downloadlwn-089dd79db9264dc0da602bad45d42f1b3e7d1e07.tar.gz
lwn-089dd79db9264dc0da602bad45d42f1b3e7d1e07.zip
perf_counter: Generate mmap events for install_special_mapping()
In order to track the vdso also generate mmap events for install_special_mapping(). Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r--kernel/perf_counter.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index a5d3e2aedd2f..37a5a241ca7e 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2255,7 +2255,7 @@ out:
}
static void perf_output_copy(struct perf_output_handle *handle,
- void *buf, unsigned int len)
+ const void *buf, unsigned int len)
{
unsigned int pages_mask;
unsigned int offset;
@@ -2681,9 +2681,10 @@ void perf_counter_comm(struct task_struct *task)
*/
struct perf_mmap_event {
- struct file *file;
- char *file_name;
- int file_size;
+ struct vm_area_struct *vma;
+
+ const char *file_name;
+ int file_size;
struct {
struct perf_event_header header;
@@ -2744,11 +2745,12 @@ static void perf_counter_mmap_event(struct perf_mmap_event *mmap_event)
{
struct perf_cpu_context *cpuctx;
struct perf_counter_context *ctx;
- struct file *file = mmap_event->file;
+ struct vm_area_struct *vma = mmap_event->vma;
+ struct file *file = vma->vm_file;
unsigned int size;
char tmp[16];
char *buf = NULL;
- char *name;
+ const char *name;
if (file) {
buf = kzalloc(PATH_MAX, GFP_KERNEL);
@@ -2762,6 +2764,15 @@ static void perf_counter_mmap_event(struct perf_mmap_event *mmap_event)
goto got_name;
}
} else {
+ name = arch_vma_name(mmap_event->vma);
+ if (name)
+ goto got_name;
+
+ if (!vma->vm_mm) {
+ name = strncpy(tmp, "[vdso]", sizeof(tmp));
+ goto got_name;
+ }
+
name = strncpy(tmp, "//anon", sizeof(tmp));
goto got_name;
}
@@ -2791,8 +2802,7 @@ got_name:
kfree(buf);
}
-void perf_counter_mmap(unsigned long addr, unsigned long len,
- unsigned long pgoff, struct file *file)
+void __perf_counter_mmap(struct vm_area_struct *vma)
{
struct perf_mmap_event mmap_event;
@@ -2800,12 +2810,12 @@ void perf_counter_mmap(unsigned long addr, unsigned long len,
return;
mmap_event = (struct perf_mmap_event){
- .file = file,
+ .vma = vma,
.event = {
.header = { .type = PERF_EVENT_MMAP, },
- .start = addr,
- .len = len,
- .pgoff = pgoff,
+ .start = vma->vm_start,
+ .len = vma->vm_end - vma->vm_start,
+ .pgoff = vma->vm_pgoff,
},
};