linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Kconfig: default to CC_OPTIMIZE_FOR_PERFORMANCE_O3 for gcc >= 10
@ 2020-05-07 22:45 Jason A. Donenfeld
  2020-05-08  8:35 ` Peter Zijlstra
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Jason A. Donenfeld @ 2020-05-07 22:45 UTC (permalink / raw)
  To: linux-kernel, x86; +Cc: Jason A. Donenfeld

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.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 init/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/init/Kconfig b/init/Kconfig
index 9e22ee8fbd75..fab3f810a68d 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1245,7 +1245,8 @@ config BOOT_CONFIG
 
 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)"
-- 
2.26.2


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-05-13 11:27 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07 22:45 [PATCH] Kconfig: default to CC_OPTIMIZE_FOR_PERFORMANCE_O3 for gcc >= 10 Jason A. Donenfeld
2020-05-08  8:35 ` Peter Zijlstra
2020-05-08  9:02 ` Oleksandr Natalenko
2020-05-08 11:21   ` Jason A. Donenfeld
2020-05-08 11:33     ` Oleksandr Natalenko
2020-05-08 11:49       ` Arnd Bergmann
2020-05-08 12:07         ` Jason A. Donenfeld
2020-05-08 13:04           ` Arnd Bergmann
2020-05-08 15:06         ` Joe Perches
2020-05-08 15:09           ` Arnd Bergmann
2020-05-10 12:47           ` David Laight
2020-05-10 17:45             ` Joe Perches
2020-05-10 18:58               ` David Laight
2020-05-12  1:10             ` Masahiro Yamada
2020-05-11 21:57   ` [PATCH v2] " Jason A. Donenfeld
2020-05-12  0:04     ` Linus Torvalds
2020-05-12  0:09       ` Linus Torvalds
2020-05-12  0:43       ` Jason A. Donenfeld
2020-05-12  8:44       ` Richard Biener
2020-05-13 11:27 ` [PATCH] " Artem S. Tashkinov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).