lkml.org 
[lkml]   [2018]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 34/64] arch/parisc: use mm locking wrappers
Date
From: Davidlohr Bueso <dave@stgolabs.net>

This becomes quite straightforward with the mmrange in place.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
arch/parisc/kernel/traps.c | 7 ++++---
arch/parisc/mm/fault.c | 8 ++++----
2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index c919e6c0a687..ac73697c7952 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -718,8 +718,9 @@ void notrace handle_interruption(int code, struct pt_regs *regs)

if (user_mode(regs)) {
struct vm_area_struct *vma;
+ DEFINE_RANGE_LOCK_FULL(mmrange);

- down_read(&current->mm->mmap_sem);
+ mm_read_lock(current->mm, &mmrange);
vma = find_vma(current->mm,regs->iaoq[0]);
if (vma && (regs->iaoq[0] >= vma->vm_start)
&& (vma->vm_flags & VM_EXEC)) {
@@ -727,10 +728,10 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
fault_address = regs->iaoq[0];
fault_space = regs->iasq[0];

- up_read(&current->mm->mmap_sem);
+ mm_read_unlock(current->mm, &mmrange);
break; /* call do_page_fault() */
}
- up_read(&current->mm->mmap_sem);
+ mm_read_unlock(current->mm, &mmrange);
}
/* Fall Through */
case 27:
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index 79db33a0cb0c..f4877e321c28 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -282,7 +282,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
if (acc_type & VM_WRITE)
flags |= FAULT_FLAG_WRITE;
retry:
- down_read(&mm->mmap_sem);
+ mm_read_lock(mm, &mmrange);
vma = find_vma_prev(mm, address, &prev_vma);
if (!vma || address < vma->vm_start)
goto check_expansion;
@@ -339,7 +339,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
goto retry;
}
}
- up_read(&mm->mmap_sem);
+ mm_read_unlock(mm, &mmrange);
return;

check_expansion:
@@ -351,7 +351,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
* Something tried to access memory that isn't in our memory map..
*/
bad_area:
- up_read(&mm->mmap_sem);
+ mm_read_unlock(mm, &mmrange);

if (user_mode(regs)) {
struct siginfo si;
@@ -427,7 +427,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
parisc_terminate("Bad Address (null pointer deref?)", regs, code, address);

out_of_memory:
- up_read(&mm->mmap_sem);
+ mm_read_unlock(mm, &mmrange);
if (!user_mode(regs))
goto no_context;
pagefault_out_of_memory();
--
2.13.6
\
 
 \ /
  Last update: 2018-02-05 02:40    [W:0.200 / U:0.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site