Skip to content

Commit

Permalink
sh: Optimise flush_dcache_page() on SH4
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matt Fleming committed Jan 2, 2010
1 parent 3f5ab76 commit b4c8927
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions arch/sh/mm/cache-sh4.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,16 @@ static inline void flush_cache_one(unsigned long start, unsigned long phys)
static void sh4_flush_dcache_page(void *arg)
{
struct page *page = arg;
unsigned long addr = (unsigned long)page_address(page);
#ifndef CONFIG_SMP
struct address_space *mapping = page_mapping(page);

if (mapping && !mapping_mapped(mapping))
set_bit(PG_dcache_dirty, &page->flags);
else
#endif
{
unsigned long phys = page_to_phys(page);
unsigned long addr = CACHE_OC_ADDRESS_ARRAY;
int i, n;

/* Loop all the D-cache */
n = boot_cpu_data.dcache.n_aliases;
for (i = 0; i < n; i++, addr += PAGE_SIZE)
flush_cache_one(addr, phys);
}
flush_cache_one(CACHE_OC_ADDRESS_ARRAY |
(addr & shm_align_mask), page_to_phys(page));

wmb();
}
Expand Down

0 comments on commit b4c8927

Please sign in to comment.