Commit 819cdcdb authored by Laurent Dufour's avatar Laurent Dufour Committed by Michael Ellerman

powerpc/mm: Move mmap_sem unlocking in do_page_fault()

Since the fault retry is now handled earlier, we can release the
mmap_sem lock earlier too and remove later unlocking previously done in
mm_fault_error().
Reviewed-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarLaurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 14c02e41
...@@ -152,13 +152,6 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault) ...@@ -152,13 +152,6 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
* continue the pagefault. * continue the pagefault.
*/ */
if (fatal_signal_pending(current)) { if (fatal_signal_pending(current)) {
/*
* If we have retry set, the mmap semaphore will have
* alrady been released in __lock_page_or_retry(). Else
* we release it now.
*/
if (!(fault & VM_FAULT_RETRY))
up_read(&current->mm->mmap_sem);
/* Coming from kernel, we need to deal with uaccess fixups */ /* Coming from kernel, we need to deal with uaccess fixups */
if (user_mode(regs)) if (user_mode(regs))
return MM_FAULT_RETURN; return MM_FAULT_RETURN;
...@@ -171,8 +164,6 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault) ...@@ -171,8 +164,6 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
/* Out of memory */ /* Out of memory */
if (fault & VM_FAULT_OOM) { if (fault & VM_FAULT_OOM) {
up_read(&current->mm->mmap_sem);
/* /*
* We ran out of memory, or some other thing happened to us that * We ran out of memory, or some other thing happened to us that
* made us unable to handle the page fault gracefully. * made us unable to handle the page fault gracefully.
...@@ -183,10 +174,8 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault) ...@@ -183,10 +174,8 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
return MM_FAULT_RETURN; return MM_FAULT_RETURN;
} }
if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) { if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE))
up_read(&current->mm->mmap_sem);
return do_sigbus(regs, addr, fault); return do_sigbus(regs, addr, fault);
}
/* We don't understand the fault code, this is fatal */ /* We don't understand the fault code, this is fatal */
BUG(); BUG();
...@@ -476,11 +465,12 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -476,11 +465,12 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
goto retry; goto retry;
} }
/* We will enter mm_fault_error() below */ /* We will enter mm_fault_error() below */
} } else
up_read(&current->mm->mmap_sem);
if (unlikely(fault & (VM_FAULT_RETRY|VM_FAULT_ERROR))) { if (unlikely(fault & (VM_FAULT_RETRY|VM_FAULT_ERROR))) {
if (fault & VM_FAULT_SIGSEGV) if (fault & VM_FAULT_SIGSEGV)
goto bad_area; goto bad_area_nosemaphore;
rc = mm_fault_error(regs, address, fault); rc = mm_fault_error(regs, address, fault);
if (rc >= MM_FAULT_RETURN) if (rc >= MM_FAULT_RETURN)
goto bail; goto bail;
...@@ -512,7 +502,6 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -512,7 +502,6 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
regs, address); regs, address);
} }
up_read(&mm->mmap_sem);
goto bail; goto bail;
bad_area: bad_area:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment