]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - arch/parisc/mm/fault.c
During VM oom condition, kill all threads in process group
[linux-2.6.git] / arch / parisc / mm / fault.c
index f6f67554c6235d4aceb5c51d2c3b5c0a82051d1b..1c091b415cd9b8375506c470527ae929b9900b9c 100644 (file)
@@ -147,6 +147,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
        struct mm_struct *mm = tsk->mm;
        const struct exception_table_entry *fix;
        unsigned long acc_type;
+       int fault;
 
        if (in_atomic() || !mm)
                goto no_context;
@@ -173,23 +174,23 @@ good_area:
         * fault.
         */
 
-       switch (handle_mm_fault(mm, vma, address, (acc_type & VM_WRITE) != 0)) {
-             case VM_FAULT_MINOR:
-               ++current->min_flt;
-               break;
-             case VM_FAULT_MAJOR:
-               ++current->maj_flt;
-               break;
-             case VM_FAULT_SIGBUS:
+       fault = handle_mm_fault(mm, vma, address, (acc_type & VM_WRITE) != 0);
+       if (unlikely(fault & VM_FAULT_ERROR)) {
                /*
                 * We hit a shared mapping outside of the file, or some
                 * other thing happened to us that made us unable to
                 * handle the page fault gracefully.
                 */
-               goto bad_area;
-             default:
-               goto out_of_memory;
+               if (fault & VM_FAULT_OOM)
+                       goto out_of_memory;
+               else if (fault & VM_FAULT_SIGBUS)
+                       goto bad_area;
+               BUG();
        }
+       if (fault & VM_FAULT_MAJOR)
+               current->maj_flt++;
+       else
+               current->min_flt++;
        up_read(&mm->mmap_sem);
        return;
 
@@ -262,6 +263,6 @@ no_context:
        up_read(&mm->mmap_sem);
        printk(KERN_CRIT "VM: killing process %s\n", current->comm);
        if (user_mode(regs))
-               do_exit(SIGKILL);
+               do_group_exit(SIGKILL);
        goto no_context;
 }