Re: [PATCH v2 1/1] mm/mmu_gather: replace IPI with synchronize_rcu() when batch allocation fails

From: Peter Zijlstra

Date: Tue Feb 24 2026 - 06:56:12 EST


On Tue, Feb 24, 2026 at 12:41:52PM +0100, Peter Zijlstra wrote:
> On Tue, Feb 24, 2026 at 11:07:00AM +0800, Lance Yang wrote:
> > From: Lance Yang <lance.yang@xxxxxxxxx>
> >
> > When freeing page tables, we try to batch them. If batch allocation fails
> > (GFP_NOWAIT), __tlb_remove_table_one() immediately frees the one without
> > batching.
> >
> > On !CONFIG_PT_RECLAIM, the fallback sends an IPI to all CPUs via
> > tlb_remove_table_sync_one(). It disrupts all CPUs even when only a single
> > process is unmapping memory. IPI broadcast was reported to hurt RT
> > workloads[1].
> >
> > tlb_remove_table_sync_one() synchronizes with lockless page-table walkers
> > (e.g. GUP-fast) that rely on IRQ disabling. These walkers use
> > local_irq_disable(), which is also an RCU read-side critical section.
> >
> > This patch introduces tlb_remove_table_sync_rcu() which uses RCU grace
> > period (synchronize_rcu()) instead of IPI broadcast. This provides the
> > same guarantee as IPI but without disrupting all CPUs. Since batch
> > allocation already failed, we are in a way slow path where sleeping is
> > acceptable - we are in process context (unmap_region, exit_mmap) with only
> > mmap_lock held. might_sleep() will catch any invalid context.
>
> So sending the IPIs also requires non-atomic context, so change there.

s/so/no/ -- typing hard