Tweaking Ubuntu 17.10 To Try To Run Like Clear Linux

Written by Michael Larabel in Operating Systems on 13 January 2018 at 12:18 PM EST. Page 1 of 5. 23 Comments.

Even with the overhead of having both KPTI and Retpoline kernel support in place, our recent Linux distribution benchmarks have shown Intel's Clear Linux generally outperforming the more popular distributions. But if applying some basic performance tweaks, can Ubuntu 17.10 perform like Clear Linux? Here are some benchmarks looking at a few factors.

In our forums there were recently some users attributing the Clear performance benefit to their CFLAGS and the distribution defaulting to the P-State "performance" governor rather than the "powersave" governor. It's true those are two of the ways this Intel open-source platform tries to deliver better out-of-the-box performance, but that is not all. Explained at, they also apply automatic feedback-driven optimizations (GCC FDO), function multi-versioning (FMV) to deliver optimized functions selected at run-time based upon the CPU micro-architecture being used, and various other approaches for trying to deliver the best out-of-the-box Linux performance that does include backporting various patches, etc. And, yes, hopefully this article can provide some motivation for Ubuntu and other distributions to become a bit more aggressive with their defaults to deliver a more optimized experience on installation.

For doing some basic comparisons on the impact of some of the easy tunables short of rebuilding an entire distribution's package archive with features like FDO or FMV, the tests I ran for this article were:

- Clear Linux 20310 as the latest release as of testing with its Linux 4.14 kernel that does include Kernel Page Table Isolation (KPTI) being enabled by default as well as the Retpoline patches to the kernel and GCC for fending off Spectre attacks. Clear is currently using GCC 7.2.1, similar to Ubuntu's GCC 7.2.0 in Ubuntu 17.10.

- Ubuntu 17.10 out-of-the-box with all available stable release updates. This means Ubuntu 17.10 did have KPTI support enabled but currently does not have Retpoline patched into its kernel. The GCC 7.2 compiler was used and out-of-the-box Ubuntu still defaults to the P-State powersave governor on Intel hardware.

- The stock Ubuntu 17.10 then switching from "powersave" to "performance" for the P-State CPU frequency scaling driver.

- Ubuntu 17.10 with P-State performance and then copying the CFLAGS/CXXFLAGS/FFLAGS set by default with Clear Linux. (Clear's default compiler flags are shown in the system table generated by the Phoronix Test Suite.) The Phoronix Test Suite automatically rebuilds tests when it notices the CFLAGS/CXXFLAGS have changed, in ensuring the flags are taken into account.

- Ubuntu 17.10 with the performance governor, the same CFLAGS/CXXFLAGS/FFLAGS, and switching to a Linux 4.14 kernel built against the same Kconfig kernel configuration as currently used by Clear Linux. Its kernel configuration file was extracted from the Clear Linux kernel RPM and then built on Ubuntu using the Linux 4.14 stable code-base.

Clear Linux 20310 vs. Ubuntu 17.10 Optimization Tests

So we get a look at the impact of three reasonably easy changes for trying to tune Ubuntu 17.10 for better performance and how that compares to Intel's upstream Clear Linux distribution. All these tests were done on the same Intel Core i7 8700K system with 16GB of RAM, Samsung 950 PRO 256GB NVMe SSD, and ASUS PRIME Z370 motherboard.

Related Articles