From: Davidlohr Bueso <dave@xxxxxxxxxxxx> This becomes quite straightforward with the mmrange in place. Signed-off-by: Davidlohr Bueso <dbueso@xxxxxxx> --- arch/arc/kernel/troubleshoot.c | 5 +++-- arch/arc/mm/fault.c | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c index 6e9a0a9a6a04..7212ba466c56 100644 --- a/arch/arc/kernel/troubleshoot.c +++ b/arch/arc/kernel/troubleshoot.c @@ -89,11 +89,12 @@ static void show_faulting_vma(unsigned long address, char *buf) dev_t dev = 0; char *nm = buf; struct mm_struct *active_mm = current->active_mm; + DEFINE_RANGE_LOCK_FULL(mmrange); /* can't use print_vma_addr() yet as it doesn't check for * non-inclusive vma */ - down_read(&active_mm->mmap_sem); + mm_read_lock(active_mm, &mmrange); vma = find_vma(active_mm, address); /* check against the find_vma( ) behaviour which returns the next VMA @@ -115,7 +116,7 @@ static void show_faulting_vma(unsigned long address, char *buf) } else pr_info(" @No matching VMA found\n"); - up_read(&active_mm->mmap_sem); + mm_read_unlock(active_mm, &mmrange); } static void show_ecr_verbose(struct pt_regs *regs) diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c index e423f764f159..235e89a3ed8e 100644 --- a/arch/arc/mm/fault.c +++ b/arch/arc/mm/fault.c @@ -100,7 +100,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) 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; @@ -143,7 +143,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) /* If Pagefault was interrupted by SIGKILL, exit page fault "early" */ if (unlikely(fatal_signal_pending(current))) { if ((fault & VM_FAULT_ERROR) && !(fault & VM_FAULT_RETRY)) - up_read(&mm->mmap_sem); + mm_read_unlock(mm, &mmrange); if (user_mode(regs)) return; } @@ -171,7 +171,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) } /* Fault Handled Gracefully */ - up_read(&mm->mmap_sem); + mm_read_unlock(mm, &mmrange); return; } @@ -190,7 +190,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) * Fix it, but check if it's kernel or user first.. */ bad_area: - up_read(&mm->mmap_sem); + mm_read_unlock(mm, &mmrange); bad_area_nosemaphore: /* User mode accesses just cause a SIGSEGV */ @@ -219,7 +219,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) die("Oops", regs, address); out_of_memory: - up_read(&mm->mmap_sem); + mm_read_unlock(mm, &mmrange); if (user_mode(regs)) { pagefault_out_of_memory(); @@ -229,7 +229,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) goto no_context; do_sigbus: - up_read(&mm->mmap_sem); + mm_read_unlock(mm, &mmrange); if (!user_mode(regs)) goto no_context; -- 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>