forked from luck/tmp_suning_uos_patched
ARM: 7757/1: mm: don't flush icache in switch_mm with hardware broadcasting
When scheduling an mm on a CPU where it hasn't previously been used, we flush the icache on that CPU so that any code loaded previously on a different core can be safely executed. For cores with hardware broadcasting of cache maintenance operations, this is clearly unnecessary, since the inner-shareable invalidation in __sync_icache_dcache will affect all CPUs. This patch conditionalises the icache flush in switch_mm based on cache_ops_need_broadcast(). Acked-by: Catalin Marinas <catalin.marinas@arm.com> Reported-by: Albin Tonnerre <albin.tonnerre@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
2874865c12
commit
621a0147d5
|
@ -18,6 +18,7 @@
|
||||||
#include <asm/cacheflush.h>
|
#include <asm/cacheflush.h>
|
||||||
#include <asm/cachetype.h>
|
#include <asm/cachetype.h>
|
||||||
#include <asm/proc-fns.h>
|
#include <asm/proc-fns.h>
|
||||||
|
#include <asm/smp_plat.h>
|
||||||
#include <asm-generic/mm_hooks.h>
|
#include <asm-generic/mm_hooks.h>
|
||||||
|
|
||||||
void __check_vmalloc_seq(struct mm_struct *mm);
|
void __check_vmalloc_seq(struct mm_struct *mm);
|
||||||
|
@ -98,12 +99,16 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
|
||||||
#ifdef CONFIG_MMU
|
#ifdef CONFIG_MMU
|
||||||
unsigned int cpu = smp_processor_id();
|
unsigned int cpu = smp_processor_id();
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
/*
|
||||||
/* check for possible thread migration */
|
* __sync_icache_dcache doesn't broadcast the I-cache invalidation,
|
||||||
if (!cpumask_empty(mm_cpumask(next)) &&
|
* so check for possible thread migration and invalidate the I-cache
|
||||||
|
* if we're new to this CPU.
|
||||||
|
*/
|
||||||
|
if (cache_ops_need_broadcast() &&
|
||||||
|
!cpumask_empty(mm_cpumask(next)) &&
|
||||||
!cpumask_test_cpu(cpu, mm_cpumask(next)))
|
!cpumask_test_cpu(cpu, mm_cpumask(next)))
|
||||||
__flush_icache_all();
|
__flush_icache_all();
|
||||||
#endif
|
|
||||||
if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) {
|
if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) {
|
||||||
check_and_switch_context(next, tsk);
|
check_and_switch_context(next, tsk);
|
||||||
if (cache_is_vivt())
|
if (cache_is_vivt())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user