diff -urNp ref/arch/alpha/mm/fault.c init/arch/alpha/mm/fault.c --- ref/arch/alpha/mm/fault.c Sat Jul 6 18:32:59 2002 +++ init/arch/alpha/mm/fault.c Sat Jul 6 18:33:08 2002 @@ -147,13 +147,12 @@ good_area: * 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; /* @@ -197,9 +196,9 @@ no_context: out_of_memory: if (current->pid == 1) { yield(); - 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)) @@ -207,6 +206,7 @@ out_of_memory: do_exit(SIGKILL); do_sigbus: + up_read(&mm->mmap_sem); /* * Send a sigbus, regardless of whether we were in kernel * or user mode. diff -urNp ref/arch/i386/mm/fault.c init/arch/i386/mm/fault.c --- ref/arch/i386/mm/fault.c Sat Jul 6 18:32:59 2002 +++ init/arch/i386/mm/fault.c Sat Jul 6 18:36:04 2002 @@ -338,12 +338,11 @@ no_context: * us unable to handle the page fault gracefully. */ out_of_memory: - up_read(&mm->mmap_sem); if (tsk->pid == 1) { yield(); - 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 -urNp ref/arch/ia64/mm/fault.c init/arch/ia64/mm/fault.c --- ref/arch/ia64/mm/fault.c Sat Jul 6 18:32:59 2002 +++ init/arch/ia64/mm/fault.c Sat Jul 6 18:33:08 2002 @@ -194,12 +194,11 @@ ia64_do_page_fault (unsigned long addres return; out_of_memory: - up_read(&mm->mmap_sem); if (current->pid == 1) { yield(); - 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 -urNp ref/arch/ppc/mm/fault.c init/arch/ppc/mm/fault.c --- ref/arch/ppc/mm/fault.c Sat Jul 6 18:32:59 2002 +++ init/arch/ppc/mm/fault.c Sat Jul 6 18:33:08 2002 @@ -196,12 +196,11 @@ bad_area: * us unable to handle the page fault gracefully. */ out_of_memory: - up_read(&mm->mmap_sem); if (current->pid == 1) { yield(); - 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 -urNp ref/arch/s390/mm/fault.c init/arch/s390/mm/fault.c --- ref/arch/s390/mm/fault.c Sat Jul 6 18:32:59 2002 +++ init/arch/s390/mm/fault.c Sat Jul 6 18:33:08 2002 @@ -288,12 +288,11 @@ no_context: * us unable to handle the page fault gracefully. */ out_of_memory: - up_read(&mm->mmap_sem); if (tsk->pid == 1) { yield(); - 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 -urNp ref/arch/s390x/mm/fault.c init/arch/s390x/mm/fault.c --- ref/arch/s390x/mm/fault.c Sat Jul 6 18:32:59 2002 +++ init/arch/s390x/mm/fault.c Sat Jul 6 18:33:08 2002 @@ -288,12 +288,11 @@ no_context: * us unable to handle the page fault gracefully. */ out_of_memory: - up_read(&mm->mmap_sem); if (tsk->pid == 1) { yield(); - 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 -urNp ref/arch/x86_64/mm/fault.c init/arch/x86_64/mm/fault.c --- ref/arch/x86_64/mm/fault.c Sat Jul 6 18:32:59 2002 +++ init/arch/x86_64/mm/fault.c Sat Jul 6 18:33:08 2002 @@ -144,7 +144,6 @@ asmlinkage void do_page_fault(struct pt_ if (in_interrupt() || !mm) goto no_context; -again: down_read(&mm->mmap_sem); vma = find_vma(mm, address); @@ -184,6 +183,7 @@ good_area: 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 @@ no_context: * 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);