]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RISC-V: Do not invoke SBI call if cpumask is empty
authorAtish Patra <atish.patra@wdc.com>
Thu, 22 Aug 2019 07:51:49 +0000 (00:51 -0700)
committerPaul Walmsley <paul.walmsley@sifive.com>
Tue, 29 Oct 2019 18:32:18 +0000 (11:32 -0700)
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>
arch/riscv/mm/tlbflush.c

index 24cd33d2c48f3cee41bd219f33ca1d857bbbd9d7..9ecaf73cd0515170fb5c61bca6b089202194d628 100644 (file)
@@ -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);
 }