diff -urN init-ref/arch/alpha/mm/fault.c init/arch/alpha/mm/fault.c --- init-ref/arch/alpha/mm/fault.c Fri Apr 26 07:34:08 2002 +++ init/arch/alpha/mm/fault.c Fri Apr 26 07:37:34 2002 @@ -147,13 +147,12 @@ * the fault. */ fault = handle_mm_fault(mm, vma, address, cause > 0); - up_read(&mm->mmap_sem); - if (fault < 0) goto out_of_memory; if (fault == 0) goto do_sigbus; + up_read(&mm->mmap_sem); return; /* @@ -198,9 +197,9 @@ if (current->pid == 1) { current->policy |= SCHED_YIELD; schedule(); - down_read(&mm->mmap_sem); goto survive; } + up_read(&mm->mmap_sem); printk(KERN_ALERT "VM: killing process %s(%d)\n", current->comm, current->pid); if (!user_mode(regs)) @@ -208,6 +207,7 @@ do_exit(SIGKILL); do_sigbus: + up_read(&mm->mmap_sem); /* * Send a sigbus, regardless of whether we were in kernel * or user mode. diff -urN init-ref/arch/i386/mm/fault.c init/arch/i386/mm/fault.c --- init-ref/arch/i386/mm/fault.c Fri Apr 26 07:34:09 2002 +++ init/arch/i386/mm/fault.c Fri Apr 26 07:37:34 2002 @@ -339,13 +339,12 @@ * us unable to handle the page fault gracefully. */ out_of_memory: - up_read(&mm->mmap_sem); if (tsk->pid == 1) { tsk->policy |= SCHED_YIELD; schedule(); - down_read(&mm->mmap_sem); goto survive; } + up_read(&mm->mmap_sem); printk("VM: killing process %s\n", tsk->comm); if (error_code & 4) do_exit(SIGKILL); diff -urN init-ref/arch/ia64/mm/fault.c init/arch/ia64/mm/fault.c --- init-ref/arch/ia64/mm/fault.c Fri Apr 26 07:34:08 2002 +++ init/arch/ia64/mm/fault.c Fri Apr 26 07:37:34 2002 @@ -194,13 +194,12 @@ return; out_of_memory: - up_read(&mm->mmap_sem); if (current->pid == 1) { current->policy |= SCHED_YIELD; schedule(); - down_read(&mm->mmap_sem); goto survive; } + up_read(&mm->mmap_sem); printk("VM: killing process %s\n", current->comm); if (user_mode(regs)) do_exit(SIGKILL); diff -urN init-ref/arch/ppc/mm/fault.c init/arch/ppc/mm/fault.c --- init-ref/arch/ppc/mm/fault.c Fri Apr 26 07:34:08 2002 +++ init/arch/ppc/mm/fault.c Fri Apr 26 07:37:34 2002 @@ -196,13 +196,12 @@ * us unable to handle the page fault gracefully. */ out_of_memory: - up_read(&mm->mmap_sem); if (current->pid == 1) { current->policy |= SCHED_YIELD; schedule(); - down_read(&mm->mmap_sem); goto survive; } + up_read(&mm->mmap_sem); printk("VM: killing process %s\n", current->comm); if (user_mode(regs)) do_exit(SIGKILL); diff -urN init-ref/arch/s390/mm/fault.c init/arch/s390/mm/fault.c --- init-ref/arch/s390/mm/fault.c Fri Apr 26 07:34:08 2002 +++ init/arch/s390/mm/fault.c Fri Apr 26 07:37:34 2002 @@ -288,13 +288,12 @@ * us unable to handle the page fault gracefully. */ out_of_memory: - up_read(&mm->mmap_sem); if (tsk->pid == 1) { tsk->policy |= SCHED_YIELD; schedule(); - down_read(&mm->mmap_sem); goto survive; } + up_read(&mm->mmap_sem); printk("VM: killing process %s\n", tsk->comm); if (regs->psw.mask & PSW_PROBLEM_STATE) do_exit(SIGKILL); diff -urN init-ref/arch/s390x/mm/fault.c init/arch/s390x/mm/fault.c --- init-ref/arch/s390x/mm/fault.c Fri Apr 26 07:34:08 2002 +++ init/arch/s390x/mm/fault.c Fri Apr 26 07:37:34 2002 @@ -288,13 +288,12 @@ * us unable to handle the page fault gracefully. */ out_of_memory: - up_read(&mm->mmap_sem); if (tsk->pid == 1) { tsk->policy |= SCHED_YIELD; schedule(); - down_read(&mm->mmap_sem); goto survive; } + up_read(&mm->mmap_sem); printk("VM: killing process %s\n", tsk->comm); if (regs->psw.mask & PSW_PROBLEM_STATE) do_exit(SIGKILL); diff -urN init-ref/arch/x86_64/mm/fault.c init/arch/x86_64/mm/fault.c --- init-ref/arch/x86_64/mm/fault.c Fri Apr 26 07:34:12 2002 +++ init/arch/x86_64/mm/fault.c Fri Apr 26 07:37:34 2002 @@ -144,7 +144,6 @@ if (in_interrupt() || !mm) goto no_context; -again: down_read(&mm->mmap_sem); vma = find_vma(mm, address); @@ -184,6 +183,7 @@ goto bad_area; } +survive: /* * If for any reason at all we couldn't handle the fault, * make sure we exit gracefully rather than endlessly redo @@ -263,12 +263,12 @@ * us unable to handle the page fault gracefully. */ out_of_memory: - up_read(&mm->mmap_sem); if (current->pid == 1) { tsk->policy |= SCHED_YIELD; schedule(); - goto again; + goto survive; } + up_read(&mm->mmap_sem); printk("VM: killing process %s\n", tsk->comm); if (error_code & 4) do_exit(SIGKILL);