Files
linux/include/asm-generic
Lance Yang 1fb3d8c20b mm/mmu_gather: replace IPI with synchronize_rcu() when batch allocation fails
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 slow path where sleeping is
acceptable - we are in process context (unmap_region, exit_mmap) with only
mmap_lock held.

tlb_remove_table_sync_one() is retained for other callers (e.g.,
khugepaged after pmdp_collapse_flush(), tlb_finish_mmu() when
tlb->fully_unshared_tables) that are not slow paths.  Converting those may
require different approaches such as targeted IPIs.

Link: https://lore.kernel.org/linux-mm/[email protected]/ [1]
Link: https://lore.kernel.org/linux-mm/[email protected]/
Link: https://lore.kernel.org/linux-mm/[email protected]/
Link: https://lore.kernel.org/linux-mm/[email protected]/
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Lance Yang <[email protected]>
Suggested-by: Peter Zijlstra (Intel) <[email protected]>
Suggested-by: Dave Hansen <[email protected]>
Suggested-by: David Hildenbrand (Arm) <[email protected]>
Acked-by: David Hildenbrand (Arm) <[email protected]>
Acked-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: Nick Piggin <[email protected]>
Cc: Will Deacon <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
2026-04-05 13:53:05 -07:00
..
2022-02-25 09:36:06 +01:00
2023-02-13 22:13:29 +01:00
…
2025-11-24 20:23:25 +01:00
…
2023-12-15 16:25:55 -08:00
2024-01-17 17:52:29 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2024-09-01 20:26:13 -07:00
…
…
2025-07-08 18:35:52 +01:00
2024-09-03 21:15:32 -07:00
…
2022-07-22 17:34:57 -05:00
2024-11-11 07:33:20 -08:00
…
2025-02-18 10:16:00 +01:00
…
…
…
2024-11-11 07:33:20 -08:00
…
…
2024-11-11 21:51:42 +01:00