Messages in this thread | | | Date | Tue, 21 Apr 2015 12:56:53 +0200 | Subject | Re: [PATCH RFC] x86: enforce inlining for atomics | From | Hagen Paul Pfeifer <> |
| |
On 21 April 2015 at 09:42, Ingo Molnar <mingo@kernel.org> wrote:
Hey Ingo, Peter, Boris,
the environment is Debian with gcc version 4.9.2. I tried to reproduce the results under Ubuntu 14.04 but their version (4.8.2!) seems fine: at max one duplicate for each atomic_* function.
> So the thing is that allyesconfig turns on -Os: > > CONFIG_CC_OPTIMIZE_FOR_SIZE=y > > which is known to make bad decisions in other areas as well ...
I can recompile with "CONFIG_CC_OPTIMIZE_FOR_SIZE=n" and check the results again!?
> If -Os does such bad inlining decisions (and the inlining examples you > cited are horrible!) then I guess a lot of the other 'inline' > functions are handled by it badly as well.
Assumption is correct - I see duplicates all over the place.
> I'm not sure we should start fighting the compiler: if a compiler does > not take 'inline' seriously then the solution is to use another > compiler, or at least to use different compiler flags. > > If inlining decisions are bad even with saner compiler options then we > can use __always_inline, and we actually do that for locking > primitives and some other low level primitives: which are typically > larger than atomics, so even reasonable compilers might uninline them.
Probably we should check this on a wider gcc front! If the behavior is an exception, or is this common behavior?
Hagen
| |