linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Michel Lespinasse <walken@google.com>,
	Rik van Riel <riel@redhat.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: [PATCH 3/4] mm: move gup() -> posix mlock() error conversion out of __mm_populate
Date: Wed, 11 Feb 2015 19:12:07 +0200	[thread overview]
Message-ID: <1423674728-214192-4-git-send-email-kirill.shutemov@linux.intel.com> (raw)
In-Reply-To: <1423674728-214192-1-git-send-email-kirill.shutemov@linux.intel.com>

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

diff --git a/mm/mlock.c b/mm/mlock.c
index c3ea18323034..0837fdb26047 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -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)
-- 
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>

  parent reply	other threads:[~2015-02-11 17:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11 17:12 [PATCH 0/4] Cleanup mm_populate() codepath Kirill A. Shutemov
2015-02-11 17:12 ` [PATCH 1/4] mm: rename FOLL_MLOCK to FOLL_POPULATE Kirill A. Shutemov
2015-02-11 19:59   ` David Rientjes
2015-02-11 17:12 ` [PATCH 2/4] mm: rename __mlock_vma_pages_range() to populate_vma_page_range() Kirill A. Shutemov
2015-02-11 19:59   ` David Rientjes
2015-02-12 11:03     ` Kirill A. Shutemov
2015-02-12 21:59       ` David Rientjes
2015-02-11 17:12 ` Kirill A. Shutemov [this message]
2015-02-11 19:59   ` [PATCH 3/4] mm: move gup() -> posix mlock() error conversion out of __mm_populate David Rientjes
2015-02-11 17:12 ` [PATCH 4/4] mm: move mm_populate()-related code to mm/gup.c Kirill A. Shutemov
2015-02-11 20:00   ` David Rientjes
2015-02-11 17:59 ` [PATCH 0/4] Cleanup mm_populate() codepath Linus Torvalds

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=1423674728-214192-4-git-send-email-kirill.shutemov@linux.intel.com \
    --to=kirill.shutemov@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.com \
    --cc=torvalds@linux-foundation.org \
    --cc=walken@google.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