From: James Bottomley <James.Bottomley@SteelEye.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] Proposed update to the kernel kmap/kunmap API
Date: Sun, 06 Aug 2006 10:01:55 -0500 [thread overview]
Message-ID: <1154876516.3683.201.camel@mulgrave.il.steeleye.com> (raw)
The simple part of the proposal is to give non-highmem architectures
access to the kmap API for the purposes of overriding (this is what the
attached patch does).
The more controversial part of the proposal is that we should now
require all architectures with coherence issues to manage data coherence
via the kmap/kunmap API. Thus driver writers never have to write code
like
kmap(page)
modify data in page
flush_kernel_dcache_page(page)
kunmap(page)
instead, kmap/kunmap will manage the coherence and driver (and
filesystem) writers don't need to worry about how to flush between kmap
and kunmap. For most architectures, the page only needs to be flushed
if it was actually written to *and* there are user mappings of it, so
the best implementation looks to be: clear the page dirty pte bit in
the kernel page tables on kmap and on kunmap, check page->mappings for
user maps, and then the dirty bit, and only flush if it both has user
mappings and is dirty.
James
Index: linux-2.6/include/linux/highmem.h
===================================================================
--- linux-2.6.orig/include/linux/highmem.h 2006-07-26 17:51:09.000000000 -0700
+++ linux-2.6/include/linux/highmem.h 2006-07-26 17:51:18.000000000 -0700
@@ -29,6 +29,7 @@
static inline unsigned int nr_free_highpages(void) { return 0; }
+#ifndef ARCH_HAS_KMAP
static inline void *kmap(struct page *page)
{
might_sleep();
@@ -41,6 +42,7 @@
#define kunmap_atomic(addr, idx) do { } while (0)
#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn))
#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
+#endif
#endif /* CONFIG_HIGHMEM */
next reply other threads:[~2006-08-06 15:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-06 15:01 James Bottomley [this message]
2006-08-06 19:48 ` Andrew Morton
2006-08-06 20:33 ` 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=1154876516.3683.201.camel@mulgrave.il.steeleye.com \
--to=james.bottomley@steeleye.com \
--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
all inboxes | Powered by JetHome®