diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-11-27 06:13:58 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-11-27 18:39:48 -0500 |
commit | 487ff32082a9bd7489d8185cf7d7a2fdf18a22fa (patch) | |
tree | 59f792ef961670026b2e71a88453fed1136aba02 /include | |
parent | 6417a917b564106dcf2b8f42687f92ad94635ddd (diff) |
Allow architectures to override copy_user_highpage()
With aliasing VIPT cache support, the ARM implementation of
clear_user_page() and copy_user_page() sets up a temporary kernel space
mapping such that we have the same cache colour as the userspace page.
This avoids having to consider any userspace aliases from this operation.
However, when highmem is enabled, kmap_atomic() have to setup mappings.
The copy_user_highpage() and clear_user_highpage() call these functions
before delegating the copies to copy_user_page() and clear_user_page().
The effect of this is that each of the *_user_highpage() functions setup
their own kmap mapping, followed by the *_user_page() functions setting
up another mapping. This is rather wasteful.
Thankfully, copy_user_highpage() can be overriden by architectures by
defining __HAVE_ARCH_COPY_USER_HIGHPAGE. However, replacement of
clear_user_highpage() is more difficult because its inline definition
is not conditional. It seems that you're expected to define
__HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE and provide a replacement
__alloc_zeroed_user_highpage() implementation instead.
The allocation itself is fine, so we don't want to override that. What
we really want to do is to override clear_user_highpage() with our own
version which doesn't kmap_atomic() unnecessarily.
Other VIPT architectures (PARISC and SH) would also like to override
this function as well.
Acked-by: Hugh Dickins <hugh@veritas.com>
Acked-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'include')
-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 7dcbc82f3b7b..13875ce9112a 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h | |||
@@ -63,12 +63,14 @@ static inline void *kmap_atomic(struct page *page, enum km_type idx) | |||
63 | #endif /* CONFIG_HIGHMEM */ | 63 | #endif /* CONFIG_HIGHMEM */ |
64 | 64 | ||
65 | /* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ | 65 | /* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ |
66 | #ifndef clear_user_highpage | ||
66 | static inline void clear_user_highpage(struct page *page, unsigned long vaddr) | 67 | static inline void clear_user_highpage(struct page *page, unsigned long vaddr) |
67 | { | 68 | { |
68 | void *addr = kmap_atomic(page, KM_USER0); | 69 | void *addr = kmap_atomic(page, KM_USER0); |
69 | clear_user_page(addr, vaddr, page); | 70 | clear_user_page(addr, vaddr, page); |
70 | kunmap_atomic(addr, KM_USER0); | 71 | kunmap_atomic(addr, KM_USER0); |
71 | } | 72 | } |
73 | #endif | ||
72 | 74 | ||
73 | #ifndef __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE | 75 | #ifndef __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE |
74 | /** | 76 | /** |