perf: Add non-exec mmap() tracking
Add the capacility to track data mmap()s. This can be used together with PERF_SAMPLE_ADDR for data profiling. Signed-off-by: Anton Blanchard <anton@samba.org> [Updated code for stable perf ABI] Signed-off-by: Eric B Munson <ebmunson@us.ibm.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Steven Rostedt <rostedt@goodmis.org> LKML-Reference: <1274193049-25997-1-git-send-email-ebmunson@us.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:

committed by
Ingo Molnar

parent
8ed92280be
commit
3af9e85928
@@ -1734,8 +1734,10 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address)
|
||||
grow = (address - vma->vm_end) >> PAGE_SHIFT;
|
||||
|
||||
error = acct_stack_growth(vma, size, grow);
|
||||
if (!error)
|
||||
if (!error) {
|
||||
vma->vm_end = address;
|
||||
perf_event_mmap(vma);
|
||||
}
|
||||
}
|
||||
anon_vma_unlock(vma);
|
||||
return error;
|
||||
@@ -1781,6 +1783,7 @@ static int expand_downwards(struct vm_area_struct *vma,
|
||||
if (!error) {
|
||||
vma->vm_start = address;
|
||||
vma->vm_pgoff -= grow;
|
||||
perf_event_mmap(vma);
|
||||
}
|
||||
}
|
||||
anon_vma_unlock(vma);
|
||||
@@ -2208,6 +2211,7 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
|
||||
vma->vm_page_prot = vm_get_page_prot(flags);
|
||||
vma_link(mm, vma, prev, rb_link, rb_parent);
|
||||
out:
|
||||
perf_event_mmap(vma);
|
||||
mm->total_vm += len >> PAGE_SHIFT;
|
||||
if (flags & VM_LOCKED) {
|
||||
if (!mlock_vma_pages_range(vma, addr, addr + len))
|
||||
|
Reference in New Issue
Block a user