freenode
Kernel & Low-Level

Kernel makes page-table freeing RCU-safe on every architecture

Lorenzo Stoakes finishes the conversion so lockless RCU page-table walks become safe kernel-wide.

Linux memory management is moving to a single rule for tearing down user page tables: free them only after an RCU grace period has elapsed. Lorenzo Stoakes posted a series that converts the last holdout architectures and deletes the CONFIG_MMU_GATHER_RCU_TABLE_FREE option that once gated the behavior.

The change matters because it lets future page-table walkers run under RCU alone, without holding the mmap or rmap locks for the entire walk. That cuts lock contention, sidesteps lock-ordering traps, and makes fast concurrent walks correct by construction. Walkers still must keep the mm alive and revalidate entries after taking the ordinary page-table lock before acting on them; only the tables themselves are guaranteed not to vanish underneath a concurrent reader.

Most architectures already deferred frees this way. The remaining work was largely mechanical configuration and tlb_remove_ptdesc wiring, with extra care for shared or slab-backed tables on sparc, m68k Motorola and ColdFire, and SuperH X2. A related fix defers freeing of the PTE tables deposited under transparent huge pages so a walker that started before a collapse cannot see its table disappear. Once every architecture was covered, the old non-RCU gather paths and the config switch itself were removed.

The series builds on earlier RCU page-table work by Hugh Dickins, Qi Zheng, and Lance Yang. With it applied, unconditional RCU page-table walks are policy rather than a per-architecture special case.