diff options
author | James Bottomley <James.Bottomley@SteelEye.com> | 2006-09-26 02:30:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-26 11:48:44 -0400 |
commit | a6ca1b99ed434f3fb41bbed647ed36c0420501e5 (patch) | |
tree | 59bb799e202f912ced4230e6b4c194c9c0097758 | |
parent | 3998b9301d3d55be8373add22b6bc5e11c1d9b71 (diff) |
[PATCH] update to the kernel kmap/kunmap API
Give non-highmem architectures access to the kmap API for the purposes of
overriding (this is what the attached patch does).
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.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | include/linux/highmem.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 85ce7ef9a512..42620e723abb 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h | |||
@@ -29,6 +29,7 @@ unsigned int nr_free_highpages(void); | |||
29 | 29 | ||
30 | static inline unsigned int nr_free_highpages(void) { return 0; } | 30 | static inline unsigned int nr_free_highpages(void) { return 0; } |
31 | 31 | ||
32 | #ifndef ARCH_HAS_KMAP | ||
32 | static inline void *kmap(struct page *page) | 33 | static inline void *kmap(struct page *page) |
33 | { | 34 | { |
34 | might_sleep(); | 35 | might_sleep(); |
@@ -41,6 +42,7 @@ static inline void *kmap(struct page *page) | |||
41 | #define kunmap_atomic(addr, idx) do { } while (0) | 42 | #define kunmap_atomic(addr, idx) do { } while (0) |
42 | #define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn)) | 43 | #define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn)) |
43 | #define kmap_atomic_to_page(ptr) virt_to_page(ptr) | 44 | #define kmap_atomic_to_page(ptr) virt_to_page(ptr) |
45 | #endif | ||
44 | 46 | ||
45 | #endif /* CONFIG_HIGHMEM */ | 47 | #endif /* CONFIG_HIGHMEM */ |
46 | 48 | ||