Skip to content

Instantly share code, notes, and snippets.

@mvaisakh
Last active July 16, 2021 01:51
Show Gist options
  • Save mvaisakh/50cfeb0308d09636ba489a79e6d8aca9 to your computer and use it in GitHub Desktop.
Save mvaisakh/50cfeb0308d09636ba489a79e6d8aca9 to your computer and use it in GitHub Desktop.
From 9638ad02a052fa44eb32e7b2d624caa520c4f0a2 Mon Sep 17 00:00:00 2001
From: Vaisakh Murali <vaisakhmurali@gmail.com>
Date: Sat, 20 Jun 2020 12:55:37 +0600
Subject: [PATCH] Makefile: Restore GCC 9.3 inline param logic
* This is a follow up commit to 6cbcf0181d09
* Based on the advice by arter97 to restore the inline params
* This overcomes the regressions introduced in GCC 10
Signed-off-by: Vaisakh Murali <vaisakhmurali@gmail.com>
---
Makefile | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index d0ce3b8117c2..7580ba5d1690 100644
--- a/Makefile
+++ b/Makefile
@@ -638,7 +638,11 @@ endif
ifdef CONFIG_LTO
LTO_CFLAGS := -flto -flto=jobserver -fno-fat-lto-objects \
-fuse-linker-plugin -fwhole-program
-KBUILD_CFLAGS += $(LTO_CFLAGS) --param=max-inline-insns-auto=1000
+KBUILD_CFLAGS += $(LTO_CFLAGS) --param=max-inline-insns-auto=1000 \
+ --param=inline-min-speedup=15 \
+ --param=max-inline-insns-single=200 \
+ --param=early-inlining-insns=14
LTO_LDFLAGS := $(LTO_CFLAGS) -Wno-lto-type-mismatch -Wno-psabi \
-Wno-stringop-overflow -flinker-output=nolto-rel
LDFINAL := $(CONFIG_SHELL) $(srctree)/scripts/gcc-ld $(LTO_LDFLAGS)
From 4216f1147e141312ea124d7619f56154b76e963f Mon Sep 17 00:00:00 2001
From: Sultan Alsawaf <sultan@kerneltoast.com>
Date: Tue, 12 May 2020 12:00:08 -0700
Subject: [PATCH] kbuild: Increase GCC automatic inline instruction limit to
1000 for LTO
GCC 10 updated its interprocedural optimizer's logic to have it make
more conservative inlining decisions, resulting in worse syscall and
hackbench performance compared to GCC 9. Although the max-inline-insns-
auto parameter's value was not altered, increasing it from the -O3
default of 30 to 1000 instructions yields improved performance with LTO,
surpassing GCC 9.
Do this only for LTO though because for non-LTO builds, this causes GCC
to produce mountains of spurious -Wmaybe-used-uninitialized warnings.
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 13b0a417889c..84d6e990417c 100644
--- a/Makefile
+++ b/Makefile
@@ -628,7 +628,7 @@ endif
ifdef CONFIG_LTO_GCC
LTO_CFLAGS := -flto -flto=jobserver -fno-fat-lto-objects \
-fuse-linker-plugin -fwhole-program
-KBUILD_CFLAGS += $(LTO_CFLAGS)
+KBUILD_CFLAGS += $(LTO_CFLAGS) --param=max-inline-insns-auto=1000
LTO_LDFLAGS := $(LTO_CFLAGS) -Wno-lto-type-mismatch -Wno-psabi \
-Wno-stringop-overflow -flinker-output=nolto-rel
LDFINAL := $(CONFIG_SHELL) $(srctree)/scripts/gcc-ld $(LTO_LDFLAGS)
@mvaisakh
Copy link
Author

These can also be used out of LTO.

@Divyanshu-Modi
Copy link

These can also be used out of LTO.

Will eva boot with these?

@mvaisakh
Copy link
Author

mvaisakh commented Jul 16, 2021

Will eva boot with these?

It should, even though this didn't give any advantage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment