mm/mlock.c: reorganize mlockall() return values and remove goto-out label
authorAlexey Klimov <klimov.linux@gmail.com>
Fri, 6 Nov 2015 02:46:00 +0000 (18:46 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Nov 2015 03:34:48 +0000 (19:34 -0800)
In mlockall syscall wrapper after out-label for goto code just doing
return.  Remove goto out statements and return error values directly.

Also instead of rewriting ret variable before every if-check move returns
to 'error'-like path under if-check.

Objdump asm listing showed me reducing by few asm lines.  Object file size
descreased from 220592 bytes to 220528 bytes for me (for aarch64).

Signed-off-by: Alexey Klimov <klimov.linux@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mlock.c

index 2593668..7e6ad9c 100644 (file)
@@ -684,14 +684,13 @@ out:
 SYSCALL_DEFINE1(mlockall, int, flags)
 {
        unsigned long lock_limit;
-       int ret = -EINVAL;
+       int ret;
 
        if (!flags || (flags & ~(MCL_CURRENT | MCL_FUTURE)))
-               goto out;
+               return -EINVAL;
 
-       ret = -EPERM;
        if (!can_do_mlock())
-               goto out;
+               return -EPERM;
 
        if (flags & MCL_CURRENT)
                lru_add_drain_all();    /* flush pagevec */
@@ -708,7 +707,7 @@ SYSCALL_DEFINE1(mlockall, int, flags)
        up_write(&current->mm->mmap_sem);
        if (!ret && (flags & MCL_CURRENT))
                mm_populate(0, TASK_SIZE);
-out:
+
        return ret;
 }