diff options
author | Eric B Munson <ebmunson@us.ibm.com> | 2010-05-18 10:30:49 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-06-09 05:12:34 -0400 |
commit | 3af9e859281bda7eb7c20b51879cf43aa788ac2e (patch) | |
tree | cddb7fc788abc826551e12bba5892c6b26942392 /mm/mmap.c | |
parent | 8ed92280be013180e24c84456ab6babcb07037cc (diff) |
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>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r-- | mm/mmap.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1734,8 +1734,10 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) | |||
1734 | grow = (address - vma->vm_end) >> PAGE_SHIFT; | 1734 | grow = (address - vma->vm_end) >> PAGE_SHIFT; |
1735 | 1735 | ||
1736 | error = acct_stack_growth(vma, size, grow); | 1736 | error = acct_stack_growth(vma, size, grow); |
1737 | if (!error) | 1737 | if (!error) { |
1738 | vma->vm_end = address; | 1738 | vma->vm_end = address; |
1739 | perf_event_mmap(vma); | ||
1740 | } | ||
1739 | } | 1741 | } |
1740 | anon_vma_unlock(vma); | 1742 | anon_vma_unlock(vma); |
1741 | return error; | 1743 | return error; |
@@ -1781,6 +1783,7 @@ static int expand_downwards(struct vm_area_struct *vma, | |||
1781 | if (!error) { | 1783 | if (!error) { |
1782 | vma->vm_start = address; | 1784 | vma->vm_start = address; |
1783 | vma->vm_pgoff -= grow; | 1785 | vma->vm_pgoff -= grow; |
1786 | perf_event_mmap(vma); | ||
1784 | } | 1787 | } |
1785 | } | 1788 | } |
1786 | anon_vma_unlock(vma); | 1789 | anon_vma_unlock(vma); |
@@ -2208,6 +2211,7 @@ unsigned long do_brk(unsigned long addr, unsigned long len) | |||
2208 | vma->vm_page_prot = vm_get_page_prot(flags); | 2211 | vma->vm_page_prot = vm_get_page_prot(flags); |
2209 | vma_link(mm, vma, prev, rb_link, rb_parent); | 2212 | vma_link(mm, vma, prev, rb_link, rb_parent); |
2210 | out: | 2213 | out: |
2214 | perf_event_mmap(vma); | ||
2211 | mm->total_vm += len >> PAGE_SHIFT; | 2215 | mm->total_vm += len >> PAGE_SHIFT; |
2212 | if (flags & VM_LOCKED) { | 2216 | if (flags & VM_LOCKED) { |
2213 | if (!mlock_vma_pages_range(vma, addr, addr + len)) | 2217 | if (!mlock_vma_pages_range(vma, addr, addr + len)) |