public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@steeleye.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: linux-arch@vger.kernel.org
Subject: Re: Potential problem with the page_mapping macro and flush_dcache_page()
Date: Sun, 19 Mar 2006 19:15:47 -0600	[thread overview]
Message-ID: <1142817348.3240.84.camel@mulgrave.il.steeleye.com> (raw)
In-Reply-To: <1142812219.3240.79.camel@mulgrave.il.steeleye.com>

On Sun, 2006-03-19 at 17:50 -0600, James Bottomley wrote:
> It looks like there's no other API I can use for this ... do you want me
> to construct another?  something like flush_anon_page()?

This is my proposal for such an API, with a default nop implementation
including the parisc implementation.

James

diff --git a/Documentation/cachetlb.txt b/Documentation/cachetlb.txt
index 4ae4188..2627c73 100644
Index: tmp-2.6/Documentation/cachetlb.txt
===================================================================
--- tmp-2.6.orig/Documentation/cachetlb.txt	2006-03-19 19:09:30.000000000 -0600
+++ tmp-2.6/Documentation/cachetlb.txt	2006-03-19 19:09:38.000000000 -0600
@@ -362,6 +362,12 @@
 	likely that you will need to flush the instruction cache
 	for copy_to_user_page().
 
+  void flush_anon_page(struct page *page, unsigned long vmaddr)
+	when the kernel needs to access the contents of an anonymous
+	page, it calls this function (currently only
+	get_user_pages()).  The default implementation is a nop (and
+	should remain so for all coherent architectures).
+
   void flush_icache_range(unsigned long start, unsigned long end)
   	When the kernel stores into addresses that it will execute
 	out of (eg when loading modules), this function is called.
Index: tmp-2.6/include/asm-parisc/cacheflush.h
===================================================================
--- tmp-2.6.orig/include/asm-parisc/cacheflush.h	2006-03-19 19:09:30.000000000 -0600
+++ tmp-2.6/include/asm-parisc/cacheflush.h	2006-03-19 19:13:19.000000000 -0600
@@ -184,6 +184,14 @@
 
 }
 
+static inline void
+flush_anon_page(struct page *page, unsigned long vmaddr)
+{
+	if (PageAnon(page))
+		flush_user_dcache_page(vmaddr);
+}
+#define ARCH_HAS_FLUSH_ANON_PAGE
+
 #ifdef CONFIG_DEBUG_RODATA
 void mark_rodata_ro(void);
 #endif
Index: tmp-2.6/include/linux/highmem.h
===================================================================
--- tmp-2.6.orig/include/linux/highmem.h	2006-03-19 19:09:30.000000000 -0600
+++ tmp-2.6/include/linux/highmem.h	2006-03-19 19:09:38.000000000 -0600
@@ -7,6 +7,12 @@
 
 #include <asm/cacheflush.h>
 
+#ifndef ARCH_HAS_FLUSH_ANON_PAGE
+static inline void flush_anon_page(struct page *page, unsigned long vmaddr)
+{
+}
+#endif
+
 #ifdef CONFIG_HIGHMEM
 
 #include <asm/highmem.h>
Index: tmp-2.6/mm/memory.c
===================================================================
--- tmp-2.6.orig/mm/memory.c	2006-03-19 19:09:30.000000000 -0600
+++ tmp-2.6/mm/memory.c	2006-03-19 19:09:38.000000000 -0600
@@ -1074,6 +1074,8 @@
 			}
 			if (pages) {
 				pages[i] = page;
+
+				flush_anon_page(page, start);
 				flush_dcache_page(page);
 			}
 			if (vmas)



  reply	other threads:[~2006-03-20  1:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-19 17:15 Potential problem with the page_mapping macro and flush_dcache_page() James Bottomley
2006-03-19 20:33 ` David S. Miller
2006-03-19 20:53   ` James Bottomley
2006-03-19 21:00     ` David S. Miller
2006-03-19 21:04       ` James Bottomley
2006-03-19 21:23         ` James Bottomley
2006-03-19 21:26           ` David S. Miller
2006-03-19 23:50             ` James Bottomley
2006-03-20  1:15               ` James Bottomley [this message]
2006-03-19 21:25         ` David S. Miller
2006-03-19 21:29           ` James Bottomley
2006-03-19 22:01             ` David S. Miller
2006-03-19 23:39               ` James Bottomley
2006-03-19 23:42                 ` David S. Miller
2006-03-23  6:20             ` Andrew Morton
2006-03-23 14:13               ` James Bottomley

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=1142817348.3240.84.camel@mulgrave.il.steeleye.com \
    --to=james.bottomley@steeleye.com \
    --cc=davem@davemloft.net \
    --cc=linux-arch@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