[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190318134151.4398b2e2@gandalf.local.home>
Date: Mon, 18 Mar 2019 13:41:51 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: torvalds@...ux-foundation.org, tglx@...utronix.de, hpa@...or.com,
julien.thierry@....com, will.deacon@....com, luto@...capital.net,
mingo@...nel.org, catalin.marinas@....com, james.morse@....com,
valentin.schneider@....com, brgerst@...il.com, jpoimboe@...hat.com,
luto@...nel.org, bp@...en8.de, dvlasenk@...hat.com,
linux-kernel@...r.kernel.org, dvyukov@...gle.com
Subject: Re: [PATCH 02/25] tracing: Improve "if" macro code generation
On Mon, 18 Mar 2019 16:38:42 +0100
Peter Zijlstra <peterz@...radead.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@...dmis.org
> Cc: valentin.schneider@....com
> Cc: luto@...capital.net
> Cc: brgerst@...il.com
> Cc: catalin.marinas@....com
> Cc: mingo@...nel.org
> Cc: dvlasenk@...hat.com
> Cc: will.deacon@....com
> Cc: julien.thierry@....com
> Cc: torvalds@...ux-foundation.org
> Cc: dvyukov@...gle.com
> Cc: bp@...en8.de
> Cc: tglx@...utronix.de
> Cc: james.morse@....com
> Cc: luto@...nel.org
> Cc: hpa@...or.com
> Reported-by: Peter Zijlstra <peterz@...radead.org>
> Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Acked-by: Steven Rostedt (VMware) <rostedt@...dmis.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 */
>
Powered by blists - more mailing lists