mm: move gup() -> posix mlock() error conversion out of __mm_populate
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Tue, 14 Apr 2015 22:44:42 +0000 (15:44 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 14 Apr 2015 23:49:00 +0000 (16:49 -0700)
This is praparation to moving mm_populate()-related code out of
mm/mlock.c.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mlock.c

index 9d0f3cd716c52fcb04331317cb4d0f82517dcdf1..0214263fca45aa92239be8a2761c8d5e2e3a8f26 100644 (file)
@@ -712,7 +712,6 @@ int __mm_populate(unsigned long start, unsigned long len, int ignore_errors)
                                ret = 0;
                                continue;       /* continue at next VMA */
                        }
-                       ret = __mlock_posix_error_return(ret);
                        break;
                }
                nend = nstart + ret * PAGE_SIZE;
@@ -750,9 +749,13 @@ SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
                error = do_mlock(start, len, 1);
 
        up_write(&current->mm->mmap_sem);
-       if (!error)
-               error = __mm_populate(start, len, 0);
-       return error;
+       if (error)
+               return error;
+
+       error = __mm_populate(start, len, 0);
+       if (error)
+               return __mlock_posix_error_return(error);
+       return 0;
 }
 
 SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len)