Linux 5.9 Performance Is Off To A Great Start With FSGSBASE Boost
The FSGSBASE support that was finally mainlined a few days ago for Linux 5.9 is off to providing a nice performance boost for both Intel and AMD systems. Looking at FSGSBASE is one of the first areas I've dived into for Linux 5.9 kernel testing with this article serving as some preview/teaser data points.
FSGSBASE support for the Linux kernel has been around a half-decade in the making and finally carried over the finish line by one of Microsoft's Linux kernel engineers. Those unfamiliar with FSGSBASE can see our earlier articles on the topic.
FSGSBASE particularly helps out context switching heavy workloads like I/O and allowing user-space software to write to the x86_64 GSBASE without kernel interaction. That in turn has been of interest to Java and others.
While going through patch review, we've benchmarked FSGSBASE patches at different points and found the performance benefits to be evident and helping in areas hurt by the likes of Spectre/Meltdown. FSGSBASE is supported on Intel CPUs since Ivy Bridge as well as newer AMD CPUs, where the performance is also helped.
On Linux 5.9 where FSGSBASE is finally mainlined, it's enabled by default on supported CPUs. FSGSBASE can be disabled at kernel boot time via the "nofsgsbase" kernel option. On Linux 5.9+, looking for "fsgsbase" in the /proc/cpuinfo is the indicator whether FSGSBASE kernel usage is happening though note prior to 5.9 on supported CPUs the "fsgsbase" string is always present.
For this article are some early data points of Linux 5.9 tested out-of-the-box on a Git snapshot and then again when booting that kernel image with "nofsgsbase" and repeating the tests. Via the Phoronix Test Suite various benchmarks relevant to FSGSBASE testing were carried out. Quick tests on both Intel Core and AMD Ryzen are done for this article while additional tests will be coming of Linux 5.9 over the weeks ahead -- 5.9-rc1 isn't even out until next weekend as marking the end of 5.9 features landing.