Lazy TLB Improvements Heading To Linux 4.19

The first change queued ahead of the Linux 4.19 kernel merge window is leaving the lazy TLB mode at page table free time. As explained by that commit, "speculative memory accesses while in lazy TLB mode can crash a system, when a CPU tries to dereference a speculative access using memory contents that used to be valid page table memory, but have since been reused for something else and point into la-la land. The latter problem can be prevented in two ways. The first is to always send a TLB shootdown IPI to CPUs in lazy TLB mode, while the second one is to only send the TLB shootdown at page table freeing time."
Beyond that fix to avoid a possible system crash in the lazy TLB mode, the lazy TLB mode is being enhanced to improve system performance. This follow-on commit is making the lazy TLB mode even lazier. "Lazy TLB mode can result in an idle CPU being woken up by a TLB flush, when all it really needs to do is reload %CR3 at the next context switch, assuming no page table pages got freed... This patch reduces total CPU use in the system by about 1-2% for a memcache workload on two socket systems, and by about 1% for a heavily multi-process netperf between two systems."
Following these patches and more is also a switch to always using the kernel's lazy TLB mode. These changes are queuing as part of the x86/mm feature work for Linux 4.19.
2 Comments