aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2009-12-14 20:59:49 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-15 11:53:21 -0500
commitc9d0bf241451a3ab7d02e1652c22b80cd7d93e8f (patch)
treef72d7eedf3fee82193407c7190321399833f422c /mm/mmap.c
parent62c0c2f198c1f2ead05c961e83ef486c45888325 (diff)
mm: uncached vma support with writenotify
Modify the generic mmap() code to keep the cache attribute in vma->vm_page_prot regardless if writenotify is enabled or not. Without this patch the cache configuration selected by f_op->mmap() is overwritten if writenotify is enabled, making it impossible to keep the vma uncached. Needed by drivers such as drivers/video/sh_mobile_lcdcfb.c which uses deferred io together with uncached memory. Signed-off-by: Magnus Damm <damm@opensource.se> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Jaya Kumar <jayakumar.lkml@gmail.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 02c09f33df8b..d9c77b2dbe9d 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1198,8 +1198,20 @@ munmap_back:
1198 goto free_vma; 1198 goto free_vma;
1199 } 1199 }
1200 1200
1201 if (vma_wants_writenotify(vma)) 1201 if (vma_wants_writenotify(vma)) {
1202 pgprot_t pprot = vma->vm_page_prot;
1203
1204 /* Can vma->vm_page_prot have changed??
1205 *
1206 * Answer: Yes, drivers may have changed it in their
1207 * f_op->mmap method.
1208 *
1209 * Ensures that vmas marked as uncached stay that way.
1210 */
1202 vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED); 1211 vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED);
1212 if (pgprot_val(pprot) == pgprot_val(pgprot_noncached(pprot)))
1213 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1214 }
1203 1215
1204 vma_link(mm, vma, prev, rb_link, rb_parent); 1216 vma_link(mm, vma, prev, rb_link, rb_parent);
1205 file = vma->vm_file; 1217 file = vma->vm_file;