Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
[linux-2.6.git] / arch / sparc / mm / fault_32.c
index a5e30c6..3fa09ba 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/signal.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
+#include <linux/perf_event.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/kdebug.h>
@@ -203,6 +204,8 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
         if (in_atomic() || !mm)
                 goto no_context;
 
+       perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
+
        down_read(&mm->mmap_sem);
 
        /*
@@ -249,10 +252,15 @@ good_area:
                        goto do_sigbus;
                BUG();
        }
-       if (fault & VM_FAULT_MAJOR)
+       if (fault & VM_FAULT_MAJOR) {
                current->maj_flt++;
-       else
+               perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
+                             regs, address);
+       } else {
                current->min_flt++;
+               perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
+                             regs, address);
+       }
        up_read(&mm->mmap_sem);
        return;
 
@@ -319,9 +327,10 @@ no_context:
  */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       printk("VM: killing process %s\n", tsk->comm);
-       if (from_user)
-               do_group_exit(SIGKILL);
+       if (from_user) {
+               pagefault_out_of_memory();
+               return;
+       }
        goto no_context;
 
 do_sigbus:
@@ -369,7 +378,7 @@ asmlinkage void do_sun4c_fault(struct pt_regs *regs, int text_fault, int write,
                               unsigned long address)
 {
        extern void sun4c_update_mmu_cache(struct vm_area_struct *,
-                                          unsigned long,pte_t);
+                                          unsigned long,pte_t *);
        extern pte_t *sun4c_pte_offset_kernel(pmd_t *,unsigned long);
        struct task_struct *tsk = current;
        struct mm_struct *mm = tsk->mm;
@@ -446,7 +455,7 @@ asmlinkage void do_sun4c_fault(struct pt_regs *regs, int text_fault, int write,
                 *       on the CPU and doing a shrink_mmap() on this vma.
                 */
                sun4c_update_mmu_cache (find_vma(current->mm, address), address,
-                                       *ptep);
+                                       ptep);
        else
                do_sparc_fault(regs, text_fault, write, address);
 }