[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-37686b1353cfc30e127cef811959cdbcd0495d98@git.kernel.org>
Date: Wed, 3 Apr 2019 01:21:49 -0700
From: tip-bot for Josh Poimboeuf <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: peterz@...radead.org, hpa@...or.com, torvalds@...ux-foundation.org,
jpoimboe@...hat.com, linux-kernel@...r.kernel.org,
mingo@...nel.org, bp@...en8.de, tglx@...utronix.de
Subject: [tip:core/objtool] tracing: Improve "if" macro code generation
Commit-ID: 37686b1353cfc30e127cef811959cdbcd0495d98
Gitweb: https://git.kernel.org/tip/37686b1353cfc30e127cef811959cdbcd0495d98
Author: Josh Poimboeuf <jpoimboe@...hat.com>
AuthorDate: Thu, 7 Mar 2019 11:48:02 -0600
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Wed, 3 Apr 2019 09:36:27 +0200
tracing: Improve "if" macro code generation
With CONFIG_PROFILE_ALL_BRANCHES=y, the "if" macro converts the
conditional to an array index. This can cause GCC to create horrible
code. When there are nested ifs, the generated code uses register
values to encode branching decisions.
Make it easier for GCC to optimize by keeping the conditional as a
conditional rather than converting it to an integer. This shrinks the
generated code quite a bit, and also makes the code sane enough for
objtool to understand.
Reported-by: Peter Zijlstra <peterz@...radead.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: brgerst@...il.com
Cc: catalin.marinas@....com
Cc: dvlasenk@...hat.com
Cc: dvyukov@...gle.com
Cc: hpa@...or.com
Cc: james.morse@....com
Cc: julien.thierry@....com
Cc: luto@...capital.net
Cc: luto@...nel.org
Cc: rostedt@...dmis.org
Cc: valentin.schneider@....com
Cc: will.deacon@....com
Link: https://lkml.kernel.org/r/20190307174802.46fmpysxyo35hh43@treble
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
include/linux/compiler.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 445348facea9..d58aa0db05f9 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -67,7 +67,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
.line = __LINE__, \
}; \
______r = !!(cond); \
- ______f.miss_hit[______r]++; \
+ ______r ? ______f.miss_hit[1]++ : ______f.miss_hit[0]++;\
______r; \
}))
#endif /* CONFIG_PROFILE_ALL_BRANCHES */
Powered by blists - more mailing lists