From: Davidlohr Bueso <dave@xxxxxxxxxxxx> This becomes quite straightforward with the mmrange in place. Signed-off-by: Davidlohr Bueso <dbueso@xxxxxxx> --- arch/alpha/kernel/traps.c | 6 ++++-- arch/alpha/mm/fault.c | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c index 4bd99a7b1c41..2d884945bd26 100644 --- a/arch/alpha/kernel/traps.c +++ b/arch/alpha/kernel/traps.c @@ -986,12 +986,14 @@ do_entUnaUser(void __user * va, unsigned long opcode, info.si_code = SEGV_ACCERR; else { struct mm_struct *mm = current->mm; - down_read(&mm->mmap_sem); + DEFINE_RANGE_LOCK_FULL(mmrange); + + mm_read_lock(mm, &mmrange); if (find_vma(mm, (unsigned long)va)) info.si_code = SEGV_ACCERR; else info.si_code = SEGV_MAPERR; - up_read(&mm->mmap_sem); + mm_read_unlock(mm, &mmrange); } info.si_addr = va; send_sig_info(SIGSEGV, &info, current); diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c index 690d86a00a20..ec0ad8e23528 100644 --- a/arch/alpha/mm/fault.c +++ b/arch/alpha/mm/fault.c @@ -118,7 +118,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr, if (user_mode(regs)) flags |= FAULT_FLAG_USER; retry: - down_read(&mm->mmap_sem); + mm_read_lock(mm, &mmrange); vma = find_vma(mm, address); if (!vma) goto bad_area; @@ -181,14 +181,14 @@ do_page_fault(unsigned long address, unsigned long mmcsr, } } - up_read(&mm->mmap_sem); + mm_read_unlock(mm, &mmrange); return; /* Something tried to access memory that isn't in our memory map. Fix it, but check if it's kernel or user first. */ bad_area: - up_read(&mm->mmap_sem); + mm_read_unlock(mm, &mmrange); if (user_mode(regs)) goto do_sigsegv; @@ -212,14 +212,14 @@ do_page_fault(unsigned long address, unsigned long mmcsr, /* We ran out of memory, or some other thing happened to us that made us unable to handle the page fault gracefully. */ out_of_memory: - up_read(&mm->mmap_sem); + mm_read_unlock(mm, &mmrange); if (!user_mode(regs)) goto no_context; pagefault_out_of_memory(); return; do_sigbus: - up_read(&mm->mmap_sem); + mm_read_unlock(mm, &mmrange); /* Send a sigbus, regardless of whether we were in kernel or user mode. */ info.si_signo = SIGBUS; -- 2.13.6 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>