TuxML / tuxml

The main repository of the TuxML project contains the scripts for building Linux kernel configurations in the large.
Apache License 2.0
4 stars 2 forks source link

Kernel size across compiler version #26

Open acherm opened 3 years ago

acherm commented 3 years ago

An interesting direction is to investigate the effect of compiler (version) on kernel sizes. For instance, gcc version 6.3 (the "normal" gcc version we used) VS gcc version 9. The principle is to compile the same .config with different versions of gcc.

We can start with --tiny kernel and then generalize to any .config (e.g., such as configs already in the database).

Let's consider --tiny first and the kernel version 4.13.3 The size of a tiny kernel with gcc 6.3 is 7317008 (bytes) ~7Mb (there are many examples in the database). The size of a tiny kernel with gcc 9.3 is 3204176 (bytes) ~3Mb (there is one example in the database, cid=193188). Is it normal?

Well, according to our ad-hoc experiments (without tuxml and just compiling from scratch in a local machine [1]), it is. As reported by @arnobl this reduction seems caused by:

See https://gcc.gnu.org/gcc-9/changes.html for explanations about the differences we observed:

Overall compile time of Firefox 66 and LibreOffice 6.2.3 on an 8-core machine was reduced by about 5% compared to GCC 8.3, and the size of LTO object files by 7%. LTO link-time improves by 11% on an 8-core machine and scales significantly better for more parallel build environments. The serial stage of the link-time optimization is 28% faster consuming 20% less memory. The parallel stage now scales to up to 128 partitions rather than 32 and reduces memory use for every worker by 30%.

We need to further investigate this trend on other .config (not only --tiny), other versions of gcc, and other versions of the kernel

For instance, starting from which gcc version there is a decrease for --tiny? Is it really >= 9?

[1] example of ad-hoc experiment:

wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.13.3.tar.xz tar xf linux-4.13.3.tar.xz cd linux-4.13.3 echo "CONFIG_64BIT=y" > x86.config; KCONFIG_ALLCONFIG=x86.config make tinyconfig make ls -alrth vmlinux 7,0M gcc --version gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609