linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Klimov <klimov.linux@gmail.com>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, jeffv@google.com,
	kirill.shutemov@linux.intel.com, rientjes@google.com,
	akpm@linux-foundation.org, alexey.klimov@linaro.org,
	yury.norov@gmail.com, Alexey Klimov <klimov.linux@gmail.com>
Subject: [PATCH] syscall/mlockall: reorganize return values and remove goto-out label
Date: Thu, 10 Sep 2015 04:57:58 +0300	[thread overview]
Message-ID: <1441850278-11173-1-git-send-email-klimov.linux@gmail.com> (raw)

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>
---
 mm/mlock.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/mm/mlock.c b/mm/mlock.c
index 25936680..7e6ad9c 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -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;
 }
 
-- 
2.1.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

                 reply	other threads:[~2015-09-10  1:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441850278-11173-1-git-send-email-klimov.linux@gmail.com \
    --to=klimov.linux@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexey.klimov@linaro.org \
    --cc=jeffv@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).