lkml.org 
[lkml]   [2005]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[patch 06/18] remap_file_pages protection support: support private vma for MAP_POPULATE
From
Date

From: Ingo Molnar <mingo@elte.hu>

Fix MAP_POPULATE | MAP_PRIVATE. We don't need the VMA to be shared if we don't
rearrange pages around. And it's trivial to do.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---

linux-2.6.git-paolo/mm/fremap.c | 7 ++++---
linux-2.6.git-paolo/mm/mmap.c | 4 ++++
2 files changed, 8 insertions(+), 3 deletions(-)

diff -puN mm/fremap.c~rfp-private-vma-2 mm/fremap.c
--- linux-2.6.git/mm/fremap.c~rfp-private-vma-2 2005-08-24 20:57:13.000000000 +0200
+++ linux-2.6.git-paolo/mm/fremap.c 2005-08-24 20:57:13.000000000 +0200
@@ -221,9 +221,6 @@ retry:
if (!vma)
goto out_unlock;

- if (!(vma->vm_flags & VM_SHARED))
- goto out_unlock;
-
if (!vma->vm_ops || !vma->vm_ops->populate || end <= start || start <
vma->vm_start || end > vma->vm_end)
goto out_unlock;
@@ -246,6 +243,8 @@ retry:
/* Must set VM_NONLINEAR before any pages are populated. */
if (pgoff != linear_page_index(vma, start) &&
!(vma->vm_flags & VM_NONLINEAR)) {
+ if (!(vma->vm_flags & VM_SHARED))
+ goto out_unlock;
if (!has_write_lock) {
up_read(&mm->mmap_sem);
down_write(&mm->mmap_sem);
@@ -264,6 +263,8 @@ retry:

if (pgprot_val(pgprot) != pgprot_val(vma->vm_page_prot) &&
!(vma->vm_flags & VM_NONUNIFORM)) {
+ if (!(vma->vm_flags & VM_SHARED))
+ goto out_unlock;
if (!has_write_lock) {
up_read(&mm->mmap_sem);
down_write(&mm->mmap_sem);
diff -puN mm/mmap.c~rfp-private-vma-2 mm/mmap.c
--- linux-2.6.git/mm/mmap.c~rfp-private-vma-2 2005-08-24 20:57:13.000000000 +0200
+++ linux-2.6.git-paolo/mm/mmap.c 2005-08-24 20:57:13.000000000 +0200
@@ -1124,6 +1124,10 @@ out:
}
if (flags & MAP_POPULATE) {
up_write(&mm->mmap_sem);
+ /*
+ * remap_file_pages() works even if the mapping is private,
+ * in the linearly-mapped case:
+ */
sys_remap_file_pages(addr, len, 0,
pgoff, flags & MAP_NONBLOCK);
down_write(&mm->mmap_sem);
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-08-26 19:11    [W:0.041 / U:9.408 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site