2006-08-26 17:44:49

by Blaisorblade

[permalink] [raw]
Subject: [PATCH RFP-V4 08/13] RFP prot support: support private vma for MAP_POPULATE

From: Ingo Molnar <[email protected]>

Fix mmap(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 <[email protected]>
---

mm/fremap.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/mm/fremap.c b/mm/fremap.c
index e62dc15..b1db410 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -191,9 +191,6 @@ retry:
if (!vma)
goto out_unlock;

- if (!(vma->vm_flags & VM_SHARED))
- goto out_unlock;
-
if (!vma->vm_ops || !vma->vm_ops->populate)
goto out_unlock;

@@ -218,6 +215,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);
@@ -236,6 +235,8 @@ retry:

if (pgprot_val(pgprot) != pgprot_val(vma->vm_page_prot) &&
!(vma->vm_flags & VM_MANYPROTS)) {
+ if (!(vma->vm_flags & VM_SHARED))
+ goto out_unlock;
if (!has_write_lock) {
up_read(&mm->mmap_sem);
down_write(&mm->mmap_sem);
Chiacchiera con i tuoi amici in tempo reale!
http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com