[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f918ecb0b6bf43f3bf0f526084d8467b@AcuMS.aculab.com>
Date: Wed, 20 Mar 2019 11:18:46 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Peter Zijlstra' <peterz@...radead.org>,
"torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"hpa@...or.com" <hpa@...or.com>,
"julien.thierry@....com" <julien.thierry@....com>,
"will.deacon@....com" <will.deacon@....com>,
"luto@...capital.net" <luto@...capital.net>,
"mingo@...nel.org" <mingo@...nel.org>,
"catalin.marinas@....com" <catalin.marinas@....com>,
"james.morse@....com" <james.morse@....com>,
"valentin.schneider@....com" <valentin.schneider@....com>,
"brgerst@...il.com" <brgerst@...il.com>,
"jpoimboe@...hat.com" <jpoimboe@...hat.com>,
"luto@...nel.org" <luto@...nel.org>, "bp@...en8.de" <bp@...en8.de>,
"dvlasenk@...hat.com" <dvlasenk@...hat.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"dvyukov@...gle.com" <dvyukov@...gle.com>,
"rostedt@...dmis.org" <rostedt@...dmis.org>
Subject: RE: [PATCH 02/25] tracing: Improve "if" macro code generation
From: > Peter Zijlstra
> Sent: 18 March 2019 15:39
>
> 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.
...
> 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); \
Is that (or maybe just the !!) needed any more??
> - ______f.miss_hit[______r]++; \
> + ______r ? ______f.miss_hit[1]++ : ______f.miss_hit[0]++;\
> ______r; \
> }))
> #endif /* CONFIG_PROFILE_ALL_BRANCHES */
>
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists