diff options
author | Jisheng Zhang <jszhang@kernel.org> | 2021-05-11 19:42:31 +0200 |
---|---|---|
committer | Palmer Dabbelt <palmerdabbelt@google.com> | 2021-05-26 07:50:52 +0200 |
commit | 8237c5243a614d33fe339bc844f90aa2b393c2a8 (patch) | |
tree | f74de6d33829e5c0d2163c8d11c23ab01ba410da /arch/riscv/mm | |
parent | riscv: mm: Drop redundant _sdata and _edata declaration (diff) | |
download | linux-8237c5243a614d33fe339bc844f90aa2b393c2a8.tar.xz linux-8237c5243a614d33fe339bc844f90aa2b393c2a8.zip |
riscv: Optimize switch_mm by passing "cpu" to flush_icache_deferred()
Directly passing the cpu to flush_icache_deferred() rather than calling
smp_processor_id() again.
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
[Palmer: drop the QEMU performance numbers, and update the comment]
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'arch/riscv/mm')
-rw-r--r-- | arch/riscv/mm/context.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/riscv/mm/context.c b/arch/riscv/mm/context.c index 68aa312fc352..83e7ae37675a 100644 --- a/arch/riscv/mm/context.c +++ b/arch/riscv/mm/context.c @@ -280,11 +280,12 @@ static inline void set_mm(struct mm_struct *mm, unsigned int cpu) * cache flush to be performed before execution resumes on each hart. This * actually performs that local instruction cache flush, which implicitly only * refers to the current hart. + * + * The "cpu" argument must be the current local CPU number. */ -static inline void flush_icache_deferred(struct mm_struct *mm) +static inline void flush_icache_deferred(struct mm_struct *mm, unsigned int cpu) { #ifdef CONFIG_SMP - unsigned int cpu = smp_processor_id(); cpumask_t *mask = &mm->context.icache_stale_mask; if (cpumask_test_cpu(cpu, mask)) { @@ -320,5 +321,5 @@ void switch_mm(struct mm_struct *prev, struct mm_struct *next, set_mm(next, cpu); - flush_icache_deferred(next); + flush_icache_deferred(next, cpu); } |