A Look At The Relative Spectre/Meltdown Mitigation Costs On Windows vs. Linux
The latest in our Windows versus Linux benchmarking is looking at the relative performance impact on both Linux and Windows of their Spectre and Meltdown mitigation techniques. This round of tests were done on Windows 10 Pro, Ubuntu 18.04 LTS, and Clear Linux when having an up-to-date system on each OS where there is Spectre/Meltdown protection and then repeating the same benchmarks after reverting/disabling the security functionality.
This round of tests were done on an Intel Core i7 8700K "Coffee Lake" system used throughout the entire benchmarking process and all BIOS/system settings remained the same during the testing process.
Windows 10 Pro Build 16299 was the Microsoft OS tested this time around. Windows 10 allows viewing the protection state via PowerShell's Get-SpeculationControlSettings and then toggling the branch target injection mitigation and kernel VA shadow via the Windows Registry. The branch target injection mitigation is for Spectre Variant Two while the kernel VA shadow is for Meltdown.
Both the daily snapshot of Ubuntu 18.04 LTS and Clear Linux have Kernel Page Table Isolation (KPTI) for Meltdown protection and full generic Retpoline support for Spectre Variant Two. Clear Linux was included alongside Ubuntu 18.04 LTS since from our tests it has generally delivered the fastest out-of-the-box performance among major Linux distributions and with it being developed by Intel has been known to carry some backports from time to time in areas like this KPTI/Retpoline optimizations. Spectre Variant Two can still be toggled via the spectre_v2=off kernel command-line parameter while KPTI can be disabled with the nopti kernel parameter. There is also __user pointer sanitization for Spectre Variant One but that cannot be easily toggled at runtime on the upstream Linux kernel.
This is our first time looking at the Spectre/Meltdown mitigation costs on Windows, so let's jump straight to that interesting data with the relative performance compared to Ubuntu and Clear Linux.