Re: Excessive TLB flush ranges

Russell King (Oracle)
2023-05-16T08:21:26Z

On Tue, May 16, 2023 at 10:18:36AM +0200, Thomas Gleixner wrote:
> On Tue, May 16 2023 at 08:37, Thomas Gleixner wrote:
> > On Mon, May 15 2023 at 22:31, Russell King wrote:
> >>> + list_for_each_entry(va, list, list) {
> >>> + /* flush range by one by one 'invlpg' */
> >>> + for (addr = va->va_start; addr < va->va_end; addr += PAGE_SIZE)
> >>> + flush_tlb_one_kernel(addr);
> >>
> >> Isn't this just the same as:
> >> flush_tlb_kernel_range(va->va_start, va->va_end);
> >
> > Indeed.
>
> Actually not. At least not on x86 where it'd end up with 3 IPIs for that
> case again, instead of having one which walks the list on each CPU.

So what the best thing to do here is up to the arch implementation.
Maybe generic code shouldn't be making the decision here about
whether to call flush_tlb_one_kernel() or flush_tlb_kernel_range().

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!