lkml.org 
[lkml]   [2019]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 02/25] tracing: Improve "if" macro code generation
On Mon, 18 Mar 2019 16:38:42 +0100
Peter Zijlstra <peterz@infradead.org> wrote:

> 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>

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

> 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 18:42    [W:0.240 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site