diff options
author | Matt Fleming <matt@console-pimps.org> | 2009-12-24 17:17:35 -0500 |
---|---|---|
committer | Matt Fleming <matt@console-pimps.org> | 2010-01-01 19:51:52 -0500 |
commit | b4c892762373c5e59c7e8db35f5f9a7658602bda (patch) | |
tree | 865bb13abd9af7dd4727f28f4abcd4299c501321 | |
parent | 3f5ab768164df9a44721660b96e0accb92eb2c24 (diff) |
sh: Optimise flush_dcache_page() on SH4
If the page is not mapped into any process's address space then aliases
cannot exist in the cache. So reduce the amount of flushing we perform.
Signed-off-by: Matt Fleming <matt@console-pimps.org>
-rw-r--r-- | arch/sh/mm/cache-sh4.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c index 560ddb6bc8a7..a2301daeefa3 100644 --- a/arch/sh/mm/cache-sh4.c +++ b/arch/sh/mm/cache-sh4.c | |||
@@ -109,6 +109,7 @@ static inline void flush_cache_one(unsigned long start, unsigned long phys) | |||
109 | static void sh4_flush_dcache_page(void *arg) | 109 | static void sh4_flush_dcache_page(void *arg) |
110 | { | 110 | { |
111 | struct page *page = arg; | 111 | struct page *page = arg; |
112 | unsigned long addr = (unsigned long)page_address(page); | ||
112 | #ifndef CONFIG_SMP | 113 | #ifndef CONFIG_SMP |
113 | struct address_space *mapping = page_mapping(page); | 114 | struct address_space *mapping = page_mapping(page); |
114 | 115 | ||
@@ -116,16 +117,8 @@ static void sh4_flush_dcache_page(void *arg) | |||
116 | set_bit(PG_dcache_dirty, &page->flags); | 117 | set_bit(PG_dcache_dirty, &page->flags); |
117 | else | 118 | else |
118 | #endif | 119 | #endif |
119 | { | 120 | flush_cache_one(CACHE_OC_ADDRESS_ARRAY | |
120 | unsigned long phys = page_to_phys(page); | 121 | (addr & shm_align_mask), page_to_phys(page)); |
121 | unsigned long addr = CACHE_OC_ADDRESS_ARRAY; | ||
122 | int i, n; | ||
123 | |||
124 | /* Loop all the D-cache */ | ||
125 | n = boot_cpu_data.dcache.n_aliases; | ||
126 | for (i = 0; i < n; i++, addr += PAGE_SIZE) | ||
127 | flush_cache_one(addr, phys); | ||
128 | } | ||
129 | 122 | ||
130 | wmb(); | 123 | wmb(); |
131 | } | 124 | } |