aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv
diff options
context:
space:
mode:
authorAtish Patra2019-08-22 00:51:49 -0700
committerPaul Walmsley2019-10-29 11:32:18 -0700
commit6384423f49c804dbca02add1945e0ccf922cb522 (patch)
tree11deafffd128f5270f4e28b5ff6726982b3438d6 /arch/riscv
parent00a5bf3a8ca30d19f24219fc3cfb74f4eab3600d (diff)
RISC-V: Do not invoke SBI call if cpumask is empty
SBI calls are expensive. If cpumask is empty, there is no need to trap via SBI as no remote tlb flushing is required. Signed-off-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
Diffstat (limited to 'arch/riscv')
-rw-r--r--arch/riscv/mm/tlbflush.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/riscv/mm/tlbflush.c b/arch/riscv/mm/tlbflush.c
index 24cd33d2c48f..9ecaf73cd051 100644
--- a/arch/riscv/mm/tlbflush.c
+++ b/arch/riscv/mm/tlbflush.c
@@ -14,6 +14,9 @@ static void __sbi_tlb_flush_range(struct cpumask *cmask, unsigned long start,
{
struct cpumask hmask;
+ if (cpumask_empty(cmask))
+ return;
+
riscv_cpuid_to_hartid_mask(cmask, &hmask);
sbi_remote_sfence_vma(hmask.bits, start, size);
}