Re: [PATCH 04/10] x86,mm: use INVLPGB for kernel TLB flushes
From: Rik van Riel
Date: Sun Dec 22 2024 - 10:14:26 EST
On Sun, 2024-12-22 at 12:16 +0100, Peter Zijlstra wrote:
> On Sat, Dec 21, 2024 at 11:06:36PM -0500, Rik van Riel wrote:
> > Use broadcast TLB invalidation for kernel addresses when available.
> >
> > +static void broadcast_kernel_range_flush(unsigned long start,
> > unsigned long end)
> > +{
> > + unsigned long addr;
> > + unsigned long maxnr = boot_cpu_data.invlpgb_count_max;
> > + unsigned long threshold = tlb_single_page_flush_ceiling *
> > maxnr;
> > +
> > + /*
> > + * TLBSYNC only waits for flushes originating on the same
> > CPU.
> > + * Disabling migration allows us to wait on all flushes.
> > + */
> > + migrate_disable();
>
> So how expensive is all this? That is, I think I would feel better is
> this were preempt_disable().
Either should work. If preempt_disable() is cheaper,
I'm happy to use that.
--
All Rights Reversed.