Re: [v2 PATCH] RISC-V: Optimize tlb flush path.

From: Andreas Schwab
Date: Tue Aug 20 2019 - 03:46:25 EST


On Aug 19 2019, Atish Patra <atish.patra@xxxxxxx> wrote:

> @@ -42,20 +43,44 @@ static inline void flush_tlb_range(struct vm_area_struct *vma,
>
> #include <asm/sbi.h>
>
> -static inline void remote_sfence_vma(struct cpumask *cmask, unsigned long start,
> - unsigned long size)
> +static void __riscv_flush_tlb(struct cpumask *cmask, unsigned long start,
> + unsigned long size)

cmask can be const.

> {
> struct cpumask hmask;
> + unsigned int hartid;
> + unsigned int cpuid;
>
> cpumask_clear(&hmask);
> +
> + if (!cmask) {
> + riscv_cpuid_to_hartid_mask(cpu_online_mask, &hmask);
> + goto issue_sfence;
> + }

Wouldn't it make sense to fall through to doing a local flush here?

if (!cmask)
cmask = cpu_online_mask;

Andreas.

--
Andreas Schwab, schwab@xxxxxxxxxxxxxx
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."