[PATCH v2 3/3] mm: mmap: cleanup code that preserves special vm_page_prot bits

From: Peter Feiner
Date: Sat Aug 23 2014 - 18:13:09 EST


Replace logic that has been factored out into a utility method.

Signed-off-by: Peter Feiner <pfeiner@xxxxxxxxxx>
---
mm/mmap.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index abcac32..c18c49a 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1618,20 +1618,8 @@ munmap_back:
goto free_vma;
}

- if (vma_wants_writenotify(vma)) {
- pgprot_t pprot = vma->vm_page_prot;
-
- /* Can vma->vm_page_prot have changed??
- *
- * Answer: Yes, drivers may have changed it in their
- * f_op->mmap method.
- *
- * Ensures that vmas marked as uncached stay that way.
- */
- vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED);
- if (pgprot_val(pprot) == pgprot_val(pgprot_noncached(pprot)))
- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
- }
+ if (vma_wants_writenotify(vma))
+ vma_enable_writenotify(vma);

vma_link(mm, vma, prev, rb_link, rb_parent);
/* Once vma denies write, undo our temporary denial count */
--
2.1.0.rc2.206.gedb03e5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/