All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] char/mem: Honor O_SYNC over intelligent setting of uncached access
@ 2009-11-18  8:05 Li Yang
  2009-11-18 10:41 ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Li Yang @ 2009-11-18  8:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, gregkh, Li Yang

The original code will automatially set the page non-cacheable if the mmap'ped
address is not in kernel managed low memory.

We already have O_SYNC flag to pass the cacheability settings.   Therefore we should
honor the case that O_SYNC is delibrately not used.  For example, it is useful to the
case that not all system memory is managed by Linux, and want to be mmaped cacheable.

Not sure if there is anything out there depending on the previous behavior.

Signed-off-by: Li Yang <leoli@freescale.com>
---
 drivers/char/mem.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index a074fce..34a9b24 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -56,12 +56,10 @@ static inline int uncached_access(struct file *file, unsigned long addr)
 	}
 #else
 	/*
-	 * Accessing memory above the top the kernel knows about or through a file pointer
-	 * that was marked O_SYNC will be done non-cached.
+	 * Accessing memory through a file pointer that was marked O_SYNC will be done
+	 * non-cached.
 	 */
-	if (file->f_flags & O_SYNC)
-		return 1;
-	return addr >= __pa(high_memory);
+	return (file->f_flags & O_SYNC) ? 1 : 0;
 #endif
 }
 
-- 
1.6.3.1.6.g4bf1f


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

end of thread, other threads:[~2009-11-18 11:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-18  8:05 [RFC] char/mem: Honor O_SYNC over intelligent setting of uncached access Li Yang
2009-11-18 10:41 ` Andi Kleen
2009-11-18 11:22   ` Li Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.