lkml.org 
[lkml]   [2019]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 02/25] tracing: Improve "if" macro code generation
With CONFIG_PROFILE_ALL_BRANCHES, 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.

Cc: rostedt@goodmis.org
Cc: valentin.schneider@arm.com
Cc: luto@amacapital.net
Cc: brgerst@gmail.com
Cc: catalin.marinas@arm.com
Cc: mingo@kernel.org
Cc: dvlasenk@redhat.com
Cc: will.deacon@arm.com
Cc: julien.thierry@arm.com
Cc: torvalds@linux-foundation.org
Cc: dvyukov@google.com
Cc: bp@alien8.de
Cc: tglx@linutronix.de
Cc: james.morse@arm.com
Cc: luto@kernel.org
Cc: hpa@zytor.com
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20190307174802.46fmpysxyo35hh43@treble
---
include/linux/compiler.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -67,7 +67,7 @@ void ftrace_likely_update(struct ftrace_
.line = __LINE__, \
}; \
______r = !!(cond); \
- ______f.miss_hit[______r]++; \
+ ______r ? ______f.miss_hit[1]++ : ______f.miss_hit[0]++;\
______r; \
}))
#endif /* CONFIG_PROFILE_ALL_BRANCHES */

\
 
 \ /
  Last update: 2019-03-18 16:53    [W:0.439 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site