All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Don't needlessly dirty mlocked pages when initially faulting them in.
@ 2007-07-26 23:52 Suleiman Souhlal
  2007-07-27  0:23 ` Andrew Morton
  0 siblings, 1 reply; 25+ messages in thread
From: Suleiman Souhlal @ 2007-07-26 23:52 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Suleiman Souhlal, Suleiman Souhlal

make_pages_present() is dirtying mlocked pages if the VMA is writable, even
though it shouldn't, by telling get_user_pages() to simulate a write fault.

A simple way to test this is to mlock a multi-GB file, and then sync.
The sync will take a long time.

As far as I can see, it should be safe to just not simulate a write fault.

Signed-off-by: Suleiman Souhlal <suleiman@google.com>
---
 mm/memory.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index f64cbf9..f43c9e8 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2664,18 +2664,17 @@ #endif /* __PAGETABLE_PMD_FOLDED */
 
 int make_pages_present(unsigned long addr, unsigned long end)
 {
-	int ret, len, write;
+	int ret, len;
 	struct vm_area_struct * vma;
 
 	vma = find_vma(current->mm, addr);
 	if (!vma)
 		return -1;
-	write = (vma->vm_flags & VM_WRITE) != 0;
 	BUG_ON(addr >= end);
 	BUG_ON(end > vma->vm_end);
 	len = (end+PAGE_SIZE-1)/PAGE_SIZE-addr/PAGE_SIZE;
 	ret = get_user_pages(current, current->mm, addr,
-			len, write, 0, NULL, NULL);
+			len, 0, 0, NULL, NULL);
 	if (ret < 0)
 		return ret;
 	return ret == len ? 0 : -1;
-- 
1.4.2


^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2007-10-12 18:03 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-26 23:52 [PATCH] Don't needlessly dirty mlocked pages when initially faulting them in Suleiman Souhlal
2007-07-27  0:23 ` Andrew Morton
2007-07-27  6:33   ` Peter Zijlstra
2007-10-12  6:50     ` Suleiman Souhlal
2007-10-12  9:03       ` [PATCH] mm: avoid dirtying shared mappings on mlock Peter Zijlstra
2007-10-11 16:57         ` Nick Piggin
2007-10-11 16:57           ` Nick Piggin
2007-10-11 17:07           ` Nick Piggin
2007-10-11 17:07             ` Nick Piggin
2007-10-12 10:37           ` Peter Zijlstra
2007-10-11 18:14             ` Nick Piggin
2007-10-11 18:14               ` Nick Piggin
2007-10-12 10:50               ` Peter Zijlstra
2007-10-12 12:23                 ` Nick Piggin
2007-10-12 12:23                   ` Nick Piggin
2007-10-12 14:53                 ` Arjan van de Ven
2007-10-12 14:53                   ` Arjan van de Ven
2007-10-12 14:58                   ` Peter Zijlstra
2007-10-12 17:45                     ` Suleiman Souhlal
2007-10-12 17:45                       ` Suleiman Souhlal
2007-10-12 17:53                       ` Arjan van de Ven
2007-10-12 17:53                         ` Arjan van de Ven
2007-10-12 18:02                       ` Peter Zijlstra
2007-10-12 18:02                         ` Peter Zijlstra
2007-10-12 13:10     ` [PATCH] Don't needlessly dirty mlocked pages when initially faulting them in Mauro Giachero

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.