The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Li Yang <leoli@freescale.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, gregkh@suse.de, Li Yang <leoli@freescale.com>
Subject: [RFC] char/mem: Honor O_SYNC over intelligent setting of uncached access
Date: Wed, 18 Nov 2009 16:05:48 +0800	[thread overview]
Message-ID: <1258531548-5015-1-git-send-email-leoli@freescale.com> (raw)

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


             reply	other threads:[~2009-11-18  7:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-18  8:05 Li Yang [this message]
2009-11-18 10:41 ` [RFC] char/mem: Honor O_SYNC over intelligent setting of uncached access Andi Kleen
2009-11-18 11:22   ` Li Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1258531548-5015-1-git-send-email-leoli@freescale.com \
    --to=leoli@freescale.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox