linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] remap_file_pages needs to check for cache coherency
@ 2013-12-27 18:00 Matthew Wilcox
  2013-12-27 18:48 ` David Miller
  2013-12-27 19:13 ` John David Anglin
  0 siblings, 2 replies; 7+ messages in thread
From: Matthew Wilcox @ 2013-12-27 18:00 UTC (permalink / raw)
  To: linux-mm; +Cc: David S. Miller, sparclinux, linux-parisc, linux-mips


It seems to me that while (for example) on SPARC, it's not possible to
create a non-coherent mapping with mmap(), after we've done an mmap,
we can then use remap_file_pages() to create a mapping that no longer
aliases in the D-cache.

I have only compile-tested this patch.  I don't have any SPARC hardware,
and my PA-RISC hardware hasn't been turned on in six years ... I noticed
this while wandering around looking at some other stuff.

diff --git a/mm/fremap.c b/mm/fremap.c
index 5bff081..01fc2e7 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -19,6 +19,7 @@
 
 #include <asm/mmu_context.h>
 #include <asm/cacheflush.h>
+#include <asm/shmparam.h>
 #include <asm/tlbflush.h>
 
 #include "internal.h"
@@ -177,6 +178,13 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
 	if (start < vma->vm_start || start + size > vma->vm_end)
 		goto out;
 
+#ifdef __ARCH_FORCE_SHMLBA
+	/* Is the mapping cache-coherent? */
+	if ((pgoff ^ linear_page_index(vma, start)) &
+	    ((SHMLBA-1) >> PAGE_SHIFT))
+		goto out;
+#endif
+
 	/* Must set VM_NONLINEAR before any pages are populated. */
 	if (!(vma->vm_flags & VM_NONLINEAR)) {
 		/*

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2013-12-27 20:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-27 18:00 [PATCH] remap_file_pages needs to check for cache coherency Matthew Wilcox
2013-12-27 18:48 ` David Miller
2013-12-27 19:20   ` Matthew Wilcox
2013-12-27 19:13 ` John David Anglin
2013-12-27 19:33   ` Matthew Wilcox
2013-12-27 19:47     ` John David Anglin
2013-12-27 20:14       ` John David Anglin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox