Kernel restores NUMA balancing for shmem after accidental disable
The fix unsticks tiered-memory workloads but can slow KVM guests that relied on the old broken skip.
A long-standing Linux memory-management bug that quietly disabled automatic NUMA balancing for shared memory has been fixed, restoring migrate-on-fault behavior for ordinary shmem and tmpfs mappings. The change matters most on tiered-memory systems, where entire working sets could otherwise remain stuck on lower-bandwidth nodes.
Johannes Weiner wrote the fix after reports of convergence problems and bandwidth bottlenecks for cachelib-style workloads. An older change meant to skip scanning of explicitly pinned VMAs had treated a missing shared policy the same as an explicit opt-out. For the common case of shmem with no shared policy, that left NUMA balancing off entirely. The corrected check falls back to the task policy, so default mappings participate again while still honoring deliberate pins.
The correction immediately showed up as a roughly 30x slowdown in a KVM MMU stress test. Yan Zhao adjusted the selftest to set an explicit local policy. KVM maintainer Sean Christopherson warned that real VMs backed by shmem could see similar pain, because NUMA balancing already fits guests poorly: VM-exits cost more than ordinary page faults.
Maintainers agreed the memory-management fix should stand. Leaving shmem balancing broken to protect a known-poor KVM setup was not acceptable, and the prior behavior simply failed to deliver what the numa_balancing sysctl promises. Operators who want to avoid the cost can disable balancing or set an explicit memory policy on the relevant tasks or regions. Discussion also noted thin documentation of how the default policy interacts with system-wide balancing, and Andrew Morton asked whether a one-time warning could ease the surprise for upgraded hosts.