Skip to content

Commit

Permalink
Kconfig: default to CC_OPTIMIZE_FOR_PERFORMANCE_O3 for gcc >= 10
Browse files Browse the repository at this point in the history
GCC 10 appears to have changed -O2 in order to make compilation time
faster when using -flto, seemingly at the expense of performance, in
particular with regards to how the inliner works. Since -O3 these days
shouldn't have the same set of bugs as 10 years ago, this commit
defaults new kernel compiles to -O3 when using gcc >= 10.

Cc: linux-kbuild@vger.kernel.org
Cc: x86@kernel.org
Cc: stable@vger.kernel.org
Cc: hjl.tools@gmail.com
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jakub Jelinek <jakub@redhat.com>
Cc: Oleksandr Natalenko <oleksandr@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Laight <David.Laight@aculab.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Link: https://lore.kernel.org/lkml/20200511215720.303181-1-Jason@zx2c4.com/
  • Loading branch information
zx2c4 authored and IamCexary committed Mar 19, 2024
1 parent c4fe461 commit 08a0f7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,8 @@ endif

choice
prompt "Compiler optimization level"
default CC_OPTIMIZE_FOR_PERFORMANCE
default CC_OPTIMIZE_FOR_PERFORMANCE_O3 if GCC_VERSION >= 100000
default CC_OPTIMIZE_FOR_PERFORMANCE if (GCC_VERSION < 100000 || CC_IS_CLANG)

config CC_OPTIMIZE_FOR_PERFORMANCE
bool "Optimize for performance (-O2)"
Expand All @@ -1274,7 +1275,6 @@ config CC_OPTIMIZE_FOR_PERFORMANCE

config CC_OPTIMIZE_FOR_PERFORMANCE_O3
bool "Optimize more for performance (-O3)"
depends on ARC
help
Choosing this option will pass "-O3" to your compiler to optimize
the kernel yet more for performance.
Expand Down

0 comments on commit 08a0f7c

Please sign in to comment.