Skip to content

Commit f9e2bdf

Browse files
committed
sh: Factor in cpu id for selection of cache colour fixmap.
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>
1 parent c4845a4 commit f9e2bdf

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎arch/sh/include/asm/fixmap.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
#define _ASM_FIXMAP_H
1515

1616
#include <linux/kernel.h>
17+
#include <linux/threads.h>
1718
#include <asm/page.h>
1819
#ifdef CONFIG_HIGHMEM
19-
#include <linux/threads.h>
2020
#include <asm/kmap_types.h>
2121
#endif
2222

@@ -46,9 +46,9 @@
4646
* fix-mapped?
4747
*/
4848
enum fixed_addresses {
49-
#define FIX_N_COLOURS 16
49+
#define FIX_N_COLOURS 8
5050
FIX_CMAP_BEGIN,
51-
FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
51+
FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * NR_CPUS),
5252
FIX_UNCACHED,
5353
#ifdef CONFIG_HIGHMEM
5454
FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */

‎arch/sh/mm/kmap.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ void *kmap_coherent(struct page *page, unsigned long addr)
3939
pagefault_disable();
4040

4141
idx = FIX_CMAP_END -
42-
((addr & current_cpu_data.dcache.alias_mask) >> PAGE_SHIFT);
42+
(((addr >> PAGE_SHIFT) & (FIX_N_COLOURS - 1)) +
43+
(FIX_N_COLOURS * smp_processor_id()));
44+
4345
vaddr = __fix_to_virt(idx);
4446

4547
BUG_ON(!pte_none(*(kmap_coherent_pte - idx)));

0 commit comments

Comments
 (0)