All of lore.kernel.org
 help / color / mirror / Atom feed
* [merged] mlock-operate-on-any-regions-with-protection-=-prot_none.patch removed from -mm tree
@ 2011-02-02 19:41 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2011-02-02 19:41 UTC (permalink / raw)
  To: walken, hughd, kosaki.motohiro, riel, tm, torvalds, mm-commits


The patch titled
     mlock: operate on any regions with protection != PROT_NONE
has been removed from the -mm tree.  Its filename was
     mlock-operate-on-any-regions-with-protection-=-prot_none.patch

This patch was dropped because it was merged into mainline or a subsystem tree

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: mlock: operate on any regions with protection != PROT_NONE
From: Michel Lespinasse <walken@google.com>

As Tao Ma noticed, 5ecfda0 ("mlock: avoid dirtying pages and triggering
writeback") breaks blktrace.  This is because blktrace mmaps a file with
PROT_WRITE permissions but without PROT_READ, so my attempt to not
unnecessarity break COW during mlock ended up causing mlock to fail with a
permission problem.

Let mlock ignore vma protection in all cases except PROT_NONE.  In
particular, mlock should not fail for PROT_WRITE regions (as in the
blktrace case, which broke at 5ecfda0) or for PROT_EXEC regions (which
seem to me like they were always broken).

Signed-off-by: Michel Lespinasse <walken@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Reported-by: Tao Ma <tm@tao.ma>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/mlock.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff -puN mm/mlock.c~mlock-operate-on-any-regions-with-protection-=-prot_none mm/mlock.c
--- a/mm/mlock.c~mlock-operate-on-any-regions-with-protection-=-prot_none
+++ a/mm/mlock.c
@@ -178,6 +178,13 @@ static long __mlock_vma_pages_range(stru
 	if ((vma->vm_flags & (VM_WRITE | VM_SHARED)) == VM_WRITE)
 		gup_flags |= FOLL_WRITE;
 
+	/*
+	 * We want mlock to succeed for regions that have any permissions
+	 * other than PROT_NONE.
+	 */
+	if (vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))
+		gup_flags |= FOLL_FORCE;
+
 	if (vma->vm_flags & VM_LOCKED)
 		gup_flags |= FOLL_MLOCK;
 
_

Patches currently in -mm which might be from walken@google.com are

origin.patch
mm-allow-gup-to-fail-instead-of-waiting-on-a-page.patch
mm-allow-gup-to-fail-instead-of-waiting-on-a-page-fix.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-02-02 19:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-02 19:41 [merged] mlock-operate-on-any-regions-with-protection-=-prot_none.patch removed from -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.