Merge commit 'v2.6.30-rc6' into perfcounters/core
[linux-2.6.git] / mm / mmap.c
index 6b7b1a9..2c1c2cb 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -28,6 +28,7 @@
 #include <linux/mempolicy.h>
 #include <linux/rmap.h>
 #include <linux/mmu_notifier.h>
+#include <linux/perf_counter.h>
 
 #include <asm/uaccess.h>
 #include <asm/cacheflush.h>
@@ -1219,6 +1220,9 @@ munmap_back:
        if (correct_wcount)
                atomic_inc(&inode->i_writecount);
 out:
+       if (vm_flags & VM_EXEC)
+               perf_counter_mmap(addr, len, pgoff, file);
+
        mm->total_vm += len >> PAGE_SHIFT;
        vm_stat_account(mm, vm_flags, file, len >> PAGE_SHIFT);
        if (vm_flags & VM_LOCKED) {
@@ -1752,6 +1756,12 @@ static void remove_vma_list(struct mm_struct *mm, struct vm_area_struct *vma)
        do {
                long nrpages = vma_pages(vma);
 
+               if (vma->vm_flags & VM_EXEC) {
+                       perf_counter_munmap(vma->vm_start,
+                                       nrpages << PAGE_SHIFT,
+                                       vma->vm_pgoff, vma->vm_file);
+               }
+
                mm->total_vm -= nrpages;
                vm_stat_account(mm, vma->vm_flags, vma->vm_file, -nrpages);
                vma = remove_vma(vma);