#Kernel_gcc_patch
This kernel patch adds additional CPU options to the Linux kernel accessible under: Processor type and features ---> Processor family --->
Why a specific patch? The kernel uses its own set of CFLAGS, KCFLAGS. For exmaple, see:
CPU Family | GCC Optimization |
---|---|
Native optimizations autodetected by GCC | -march=native |
AMD K8-family | -march=k8 |
AMD Improved K8-family | -march=k8-sse3 |
AMD Family 10h (K10/Barcelona) | -march=amdfam10 |
AMD Family 14h (Bobcat) | -march=btver1 |
AMD Family 16h (Jaguar) | -march=btver2 |
AMD Family 15h (Bulldozer) | -march=bdver1 |
AMD Piledriver Family 15h (Piledriver) | -march=bdver2 |
AMD Steamroller Family 15h 30h-3fh models (Steamroller) | -march=bdver3 |
AMD Excavator Family 15h (Excavator) | -march=bdver4 |
AMD Zen Family 17h (Zen) (GCC >= 6.2) | -march=znver1 |
Intel Bonnell family of low-power Atom processors (Bonnell) | -march=bonnell |
Intel Silvermont family of low-power Atom processors (Silvermont) | -march=silvermont |
Intel 1st Gen Core i3/i5/i7-family (Nehalem) | -march=nehalem |
Intel 1.5 Gen Core i3/i5/i7-family (Westmere) | -march=westmere |
Intel 2nd Gen Core i3/i5/i7-family (Sandybridge) | -march=sandybridge |
Intel 3rd Gen Core i3/i5/i7-family (Ivybridge) | -march=ivybridge |
Intel 4th Gen Core i3/i5/i7-family (Haswell) | -march=haswell |
Intel 5th Gen Core i3/i5/i7-family (Broadwell) | -march=broadwell |
Intel 6th Gen Core i3/i5/i7-family (Skylake) | -march=skylake |
#Benchmarks ##Intro Three different machines running a generic x86-64 kernel and an otherwise identical kernel running with the optimized gcc options were tested using a make based endpoint.
##Conclusion There are small but real speed increases to running with this patch as judged by a make endpoint. The increases are on par with the speed increase that the upstream sanctioned core2 option gives users, so not including additional options seems somewhat arbitrary to me.
##Details
- Three test machines: Intel Xeon X3360, Intel i7-2620M, Intel Core i7-3660K.
- All ran the make benchmark (linked below) 35 times while booted into a 'generic' kernel. Then all ran the same make benchmark 35 times after booting into an optimized kernel. Below are the optimizations chosen for each machine.
- X3360 = core2
- i7-2620M = sandybridge
- i7-3660K = ivybridge
- Results were analyzed for statistical significance via ANOVA plots that clearly show statistically significant albeit small differences.
##Discussion
- All the assumptions for ANOVA are met:
- Data are normally distributed as show in the normal quantile plots.
- The population variances are fairly equal (Levene and Barlett tests).
- The ANOVA plots clearly show significance.
- Pair-wise analysis by Tukey-Kramer shows significance at the 0.05 level for all CPUs compared.
Below are the differences in median values:
CPU | Difference in median value |
---|---|
core2 | +87.5 ms |
sandybridge | +79.7 ms |
ivybridge | +257.2 ms |
##References
- Bash script that controls the benchmark: https://github.com/graysky2/bin/blob/master/bench
- Log file generated by script: http://repo-ck.com/bench/compile_time_optimization.txt.gz
##Credit
- Original author: jeroen AT linuxforge DOT net
- Link to original version: http://www.linuxforge.net/docs/linux/linux-gcc.php
Find support for older version of the linux kernel and of gcc in the outdated_versions directory.