aboutsummaryrefslogtreecommitdiff
path: root/arch/sh
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-12-04 15:14:52 +0900
committerPaul Mundt <lethal@linux-sh.org>2009-12-04 15:14:52 +0900
commit7e01c949989b984c074469e04ab99c47367c7187 (patch)
tree86b505a69cbbffb8319466453a0e945f771e19ae /arch/sh
parent8144a7dd51712ab58d052f4df4420768ec5489ef (diff)
sh: Partial revert of copy/clear_user_highpage() optimizations.
These still require more testing, so revert them for now. We keep the off-by-1 in the fixmap colouring and drop the rest. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/mm/cache.c66
1 files changed, 13 insertions, 53 deletions
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c
index 997c7e42b1e..e9415d3ea94 100644
--- a/arch/sh/mm/cache.c
+++ b/arch/sh/mm/cache.c
@@ -46,18 +46,6 @@ static inline void cacheop_on_each_cpu(void (*func) (void *info), void *info,
preempt_enable();
}
-/*
- * copy_to_user_page
- * @vma: vm_area_struct holding the pages
- * @page: struct page
- * @vaddr: user space address
- * @dst: address of page in kernel space (possibly from kmap)
- * @src: source address in kernel logical memory
- * @len: length of data in bytes (may be less than PAGE_SIZE)
- *
- * Copy data into the address space of a process other than the current
- * process (eg for ptrace).
- */
void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
unsigned long vaddr, void *dst, const void *src,
unsigned long len)
@@ -93,49 +81,28 @@ void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
}
}
-/*
- * copy_user_highpage
- * @to: destination page
- * @from: source page
- * @vaddr: address of pages in user address space
- * @vma: vm_area_struct holding the pages
- *
- * This is used in COW implementation to copy data from page @from to
- * page @to. @from was previousl mapped at @vaddr, and @to will be.
- * As this is used only in the COW implementation, this means that the
- * source is unmodified, and so we don't have to worry about cache
- * aliasing on that side.
- */
-#ifdef CONFIG_HIGHMEM
-/*
- * If we ever have a real highmem system, this code will need fixing
- * (as will clear_user/clear_user_highmem), because the kmap potentitally
- * creates another alias risk.
- */
-#error This code is broken with real HIGHMEM
-#endif
void copy_user_highpage(struct page *to, struct page *from,
unsigned long vaddr, struct vm_area_struct *vma)
{
void *vfrom, *vto;
vto = kmap_atomic(to, KM_USER1);
- vfrom = kmap_atomic(from, KM_USER0);
-
- if (pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
- __flush_invalidate_region(vto, PAGE_SIZE);
if (boot_cpu_data.dcache.n_aliases && page_mapped(from) &&
!test_bit(PG_dcache_dirty, &from->flags)) {
- void *vto_coloured = kmap_coherent(to, vaddr);
- copy_page(vto_coloured, vfrom);
- kunmap_coherent(vto_coloured);
- } else
+ vfrom = kmap_coherent(from, vaddr);
copy_page(vto, vfrom);
+ kunmap_coherent(vfrom);
+ } else {
+ vfrom = kmap_atomic(from, KM_USER0);
+ copy_page(vto, vfrom);
+ kunmap_atomic(vfrom, KM_USER0);
+ }
- kunmap_atomic(vfrom, KM_USER0);
- kunmap_atomic(vto, KM_USER1);
+ if (pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
+ __flush_purge_region(vto, PAGE_SIZE);
+ kunmap_atomic(vto, KM_USER1);
/* Make sure this page is cleared on other CPU's too before using it */
smp_wmb();
}
@@ -145,17 +112,10 @@ void clear_user_highpage(struct page *page, unsigned long vaddr)
{
void *kaddr = kmap_atomic(page, KM_USER0);
- if (pages_do_alias((unsigned long)kaddr, vaddr & PAGE_MASK)) {
- void *vto;
+ clear_page(kaddr);
- /* Kernel alias may have modified data in the cache. */
- __flush_invalidate_region(kaddr, PAGE_SIZE);
-
- vto = kmap_coherent(page, vaddr);
- clear_page(vto);
- kunmap_coherent(vto);
- } else
- clear_page(kaddr);
+ if (pages_do_alias((unsigned long)kaddr, vaddr & PAGE_MASK))
+ __flush_purge_region(kaddr, PAGE_SIZE);
kunmap_atomic(kaddr, KM_USER0);
}