From: Davidlohr Bueso <d...@stgolabs.net>

Conversion is straightforward, mmap_sem is used within the
same function context. No changes in semantics.

Signed-off-by: Davidlohr Bueso <dbu...@suse.de>
---
 mm/mlock.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/mm/mlock.c b/mm/mlock.c
index 3f6bd953e8b0..dfd175b2cf20 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -686,7 +686,7 @@ static __must_check int do_mlock(unsigned long start, 
size_t len,
        lock_limit >>= PAGE_SHIFT;
        locked = len >> PAGE_SHIFT;
 
-       if (down_write_killable(&current->mm->mmap_sem))
+       if (mm_write_lock_killable(current->mm, &mmrange))
                return -EINTR;
 
        locked += current->mm->locked_vm;
@@ -705,7 +705,7 @@ static __must_check int do_mlock(unsigned long start, 
size_t len,
        if ((locked <= lock_limit) || capable(CAP_IPC_LOCK))
                error = apply_vma_lock_flags(start, len, flags, &mmrange);
 
-       up_write(&current->mm->mmap_sem);
+       mm_write_unlock(current->mm, &mmrange);
        if (error)
                return error;
 
@@ -741,10 +741,10 @@ SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, 
len)
        len = PAGE_ALIGN(len + (offset_in_page(start)));
        start &= PAGE_MASK;
 
-       if (down_write_killable(&current->mm->mmap_sem))
+       if (mm_write_lock_killable(current->mm, &mmrange))
                return -EINTR;
        ret = apply_vma_lock_flags(start, len, 0, &mmrange);
-       up_write(&current->mm->mmap_sem);
+       mm_write_unlock(current->mm, &mmrange);
 
        return ret;
 }
@@ -811,14 +811,14 @@ SYSCALL_DEFINE1(mlockall, int, flags)
        lock_limit = rlimit(RLIMIT_MEMLOCK);
        lock_limit >>= PAGE_SHIFT;
 
-       if (down_write_killable(&current->mm->mmap_sem))
+       if (mm_write_lock_killable(current->mm, &mmrange))
                return -EINTR;
 
        ret = -ENOMEM;
        if (!(flags & MCL_CURRENT) || (current->mm->total_vm <= lock_limit) ||
            capable(CAP_IPC_LOCK))
                ret = apply_mlockall_flags(flags, &mmrange);
-       up_write(&current->mm->mmap_sem);
+       mm_write_unlock(current->mm, &mmrange);
        if (!ret && (flags & MCL_CURRENT))
                mm_populate(0, TASK_SIZE);
 
@@ -830,10 +830,10 @@ SYSCALL_DEFINE0(munlockall)
        int ret;
        DEFINE_RANGE_LOCK_FULL(mmrange);
 
-       if (down_write_killable(&current->mm->mmap_sem))
+       if (mm_write_lock_killable(current->mm, &mmrange))
                return -EINTR;
        ret = apply_mlockall_flags(0, &mmrange);
-       up_write(&current->mm->mmap_sem);
+       mm_write_unlock(current->mm, &mmrange);
        return ret;
 }
 
-- 
2.13.6

Reply via email to