]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sh: Factor in cpu id for selection of cache colour fixmap.
authorPaul Mundt <lethal@linux-sh.org>
Wed, 9 Sep 2009 08:14:19 +0000 (17:14 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Wed, 9 Sep 2009 08:14:19 +0000 (17:14 +0900)
In the SMP VIPT case the page copy/clear ops still perform colouring,
care needs to be taken that CPUs don't end up stepping on each other,
so we give them a bit of room to work with.

At the same time, we reduce the worst-case colouring given that these
pages are always consumed.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/include/asm/fixmap.h
arch/sh/mm/kmap.c

index 721fcc4d5e98ed20a90d7ee187d17ada4944ee83..76c5a3099cb8d31dbd2a564b0a56afe35060003e 100644 (file)
@@ -14,9 +14,9 @@
 #define _ASM_FIXMAP_H
 
 #include <linux/kernel.h>
+#include <linux/threads.h>
 #include <asm/page.h>
 #ifdef CONFIG_HIGHMEM
-#include <linux/threads.h>
 #include <asm/kmap_types.h>
 #endif
 
@@ -46,9 +46,9 @@
  * fix-mapped?
  */
 enum fixed_addresses {
-#define FIX_N_COLOURS 16
+#define FIX_N_COLOURS 8
        FIX_CMAP_BEGIN,
-       FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
+       FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * NR_CPUS),
        FIX_UNCACHED,
 #ifdef CONFIG_HIGHMEM
        FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
index 16e01b5fed0435147513f4836baf21b31641428e..15d74ea4209497b8d938840a7fbf6b7cfce19666 100644 (file)
@@ -39,7 +39,9 @@ void *kmap_coherent(struct page *page, unsigned long addr)
        pagefault_disable();
 
        idx = FIX_CMAP_END -
-               ((addr & current_cpu_data.dcache.alias_mask) >> PAGE_SHIFT);
+               (((addr >> PAGE_SHIFT) & (FIX_N_COLOURS - 1)) +
+                (FIX_N_COLOURS * smp_processor_id()));
+
        vaddr = __fix_to_virt(idx);
 
        BUG_ON(!pte_none(*(kmap_coherent_pte - idx)));