[PATCH] force inlining of spinlock ops

2015-07-13 Thread Denys Vlasenko
With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline very small functions we expect to be inlined. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66122 In particular, with this config: http://busybox.net/~vda/kernel_config there are more than a thousand copies of tiny

[PATCH] force inlining of spinlock ops

2015-07-13 Thread Denys Vlasenko
With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline very small functions we expect to be inlined. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66122 In particular, with this config: http://busybox.net/~vda/kernel_config there are more than a thousand copies of tiny

Re: [PATCH] force inlining of spinlock ops

2015-05-15 Thread Heiko Carstens
On Wed, May 13, 2015 at 04:09:18PM +0200, Denys Vlasenko wrote: > On 05/13/2015 12:43 PM, Ingo Molnar wrote: > > We only know that the net effect is +70 bytes. Does that come out of: > > > > - large fluctuations such as -1000-1000+1000+1070, which happens to > >net out into a small net

Re: [PATCH] force inlining of spinlock ops

2015-05-15 Thread Heiko Carstens
On Wed, May 13, 2015 at 04:09:18PM +0200, Denys Vlasenko wrote: On 05/13/2015 12:43 PM, Ingo Molnar wrote: We only know that the net effect is +70 bytes. Does that come out of: - large fluctuations such as -1000-1000+1000+1070, which happens to net out into a small net number?

Re: [PATCH] force inlining of spinlock ops

2015-05-13 Thread Denys Vlasenko
On 05/13/2015 12:43 PM, Ingo Molnar wrote: > > * Denys Vlasenko wrote: > >> On 05/13/2015 12:17 PM, Ingo Molnar wrote: > In any case, the interesting measurement would not be -Os comparisons > (which causes GCC to be too crazy), but to see the size effect of your > _patch_ that

Re: [PATCH] force inlining of spinlock ops

2015-05-13 Thread Ingo Molnar
* Denys Vlasenko wrote: > On 05/13/2015 12:17 PM, Ingo Molnar wrote: > >>> In any case, the interesting measurement would not be -Os comparisons > >>> (which causes GCC to be too crazy), but to see the size effect of your > >>> _patch_ that always-inlines spinlock ops, on plain defconfig and

Re: [PATCH] force inlining of spinlock ops

2015-05-13 Thread Denys Vlasenko
On 05/13/2015 12:17 PM, Ingo Molnar wrote: >>> In any case, the interesting measurement would not be -Os comparisons >>> (which causes GCC to be too crazy), but to see the size effect of your >>> _patch_ that always-inlines spinlock ops, on plain defconfig and on >>> defconfig-Os. >> >> Here it

Re: [PATCH] force inlining of spinlock ops

2015-05-13 Thread Ingo Molnar
* Denys Vlasenko wrote: > On 05/12/2015 01:43 PM, Ingo Molnar wrote: > >>> Furtermore, what is the size win on x86 defconfig with these options > >>> set? > >> > >> CONFIG_OPTIMIZE_INLINING=y is in defconfig. > >> > >> Size difference for CC_OPTIMIZE_FOR_SIZE: > >> > >> textdata

Re: [PATCH] force inlining of spinlock ops

2015-05-13 Thread Ingo Molnar
* Denys Vlasenko dvlas...@redhat.com wrote: On 05/13/2015 12:17 PM, Ingo Molnar wrote: In any case, the interesting measurement would not be -Os comparisons (which causes GCC to be too crazy), but to see the size effect of your _patch_ that always-inlines spinlock ops, on plain

Re: [PATCH] force inlining of spinlock ops

2015-05-13 Thread Denys Vlasenko
On 05/13/2015 12:17 PM, Ingo Molnar wrote: In any case, the interesting measurement would not be -Os comparisons (which causes GCC to be too crazy), but to see the size effect of your _patch_ that always-inlines spinlock ops, on plain defconfig and on defconfig-Os. Here it is: text

Re: [PATCH] force inlining of spinlock ops

2015-05-13 Thread Ingo Molnar
* Denys Vlasenko dvlas...@redhat.com wrote: On 05/12/2015 01:43 PM, Ingo Molnar wrote: Furtermore, what is the size win on x86 defconfig with these options set? CONFIG_OPTIMIZE_INLINING=y is in defconfig. Size difference for CC_OPTIMIZE_FOR_SIZE: textdata bss

Re: [PATCH] force inlining of spinlock ops

2015-05-13 Thread Denys Vlasenko
On 05/13/2015 12:43 PM, Ingo Molnar wrote: * Denys Vlasenko dvlas...@redhat.com wrote: On 05/13/2015 12:17 PM, Ingo Molnar wrote: In any case, the interesting measurement would not be -Os comparisons (which causes GCC to be too crazy), but to see the size effect of your _patch_ that

Re: [PATCH] force inlining of spinlock ops

2015-05-12 Thread Denys Vlasenko
On 05/12/2015 01:43 PM, Ingo Molnar wrote: >>> Furtermore, what is the size win on x86 defconfig with these options >>> set? >> >> CONFIG_OPTIMIZE_INLINING=y is in defconfig. >> >> Size difference for CC_OPTIMIZE_FOR_SIZE: >> >> textdata bss dechex filename >> 12335864

Re: [PATCH] force inlining of spinlock ops

2015-05-12 Thread Ingo Molnar
* Denys Vlasenko wrote: > On 05/12/2015 09:44 AM, Ingo Molnar wrote: > > > > * Denys Vlasenko wrote: > > > >> With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline > >> very small functions we expect to be inlined. In particular, > >> with this config:

Re: [PATCH] force inlining of spinlock ops

2015-05-12 Thread Denys Vlasenko
On 05/12/2015 09:44 AM, Ingo Molnar wrote: > > * Denys Vlasenko wrote: > >> With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline >> very small functions we expect to be inlined. In particular, >> with this config: http://busybox.net/~vda/kernel_config >> there are more than

Re: [PATCH] force inlining of spinlock ops

2015-05-12 Thread Ingo Molnar
* Denys Vlasenko wrote: > > Also, the inline_for_broken_gcc definition can be made dependent > > on particular gcc versions, which will allow us to easily keep an > > eye on the behaviour of later gcc versions. > > I've seen it on gcc-4.7.2 and gcc-4.9.2, so this behavior is not > limited

Re: [PATCH] force inlining of spinlock ops

2015-05-12 Thread Denys Vlasenko
On 05/12/2015 12:19 AM, Andrew Morton wrote: > On Mon, 11 May 2015 19:57:22 +0200 Denys Vlasenko wrote: > >> With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline >> very small functions we expect to be inlined. In particular, >> with this config:

Re: [PATCH] force inlining of spinlock ops

2015-05-12 Thread Hagen Paul Pfeifer
* Andrew Morton | 2015-05-11 15:19:13 [-0700]: >Presumably Hagen didn't see the issue with spinlock functions. I >wonder why not. I think it is a compiler version thing. Not sure why I didn't see it. >I suppose we should get both these consolidated into a coherent whole. +1 (let wait for a

Re: [PATCH] force inlining of spinlock ops

2015-05-12 Thread Ingo Molnar
* Denys Vlasenko wrote: > With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline > very small functions we expect to be inlined. In particular, > with this config: http://busybox.net/~vda/kernel_config > there are more than a thousand copies of tiny spinlock-related functions:

Re: [PATCH] force inlining of spinlock ops

2015-05-12 Thread Ingo Molnar
* Denys Vlasenko dvlas...@redhat.com wrote: With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline very small functions we expect to be inlined. In particular, with this config: http://busybox.net/~vda/kernel_config there are more than a thousand copies of tiny

Re: [PATCH] force inlining of spinlock ops

2015-05-12 Thread Hagen Paul Pfeifer
* Andrew Morton | 2015-05-11 15:19:13 [-0700]: Presumably Hagen didn't see the issue with spinlock functions. I wonder why not. I think it is a compiler version thing. Not sure why I didn't see it. I suppose we should get both these consolidated into a coherent whole. +1 (let wait for a

Re: [PATCH] force inlining of spinlock ops

2015-05-12 Thread Ingo Molnar
* Denys Vlasenko dvlas...@redhat.com wrote: Also, the inline_for_broken_gcc definition can be made dependent on particular gcc versions, which will allow us to easily keep an eye on the behaviour of later gcc versions. I've seen it on gcc-4.7.2 and gcc-4.9.2, so this behavior is not

Re: [PATCH] force inlining of spinlock ops

2015-05-12 Thread Denys Vlasenko
On 05/12/2015 09:44 AM, Ingo Molnar wrote: * Denys Vlasenko dvlas...@redhat.com wrote: With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline very small functions we expect to be inlined. In particular, with this config: http://busybox.net/~vda/kernel_config there are

Re: [PATCH] force inlining of spinlock ops

2015-05-12 Thread Ingo Molnar
* Denys Vlasenko dvlas...@redhat.com wrote: On 05/12/2015 09:44 AM, Ingo Molnar wrote: * Denys Vlasenko dvlas...@redhat.com wrote: With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline very small functions we expect to be inlined. In particular, with this

Re: [PATCH] force inlining of spinlock ops

2015-05-12 Thread Denys Vlasenko
On 05/12/2015 12:19 AM, Andrew Morton wrote: On Mon, 11 May 2015 19:57:22 +0200 Denys Vlasenko dvlas...@redhat.com wrote: With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline very small functions we expect to be inlined. In particular, with this config:

Re: [PATCH] force inlining of spinlock ops

2015-05-12 Thread Denys Vlasenko
On 05/12/2015 01:43 PM, Ingo Molnar wrote: Furtermore, what is the size win on x86 defconfig with these options set? CONFIG_OPTIMIZE_INLINING=y is in defconfig. Size difference for CC_OPTIMIZE_FOR_SIZE: textdata bss dechex filename 12335864 1746152 1081344 15163360

Re: [PATCH] force inlining of spinlock ops

2015-05-11 Thread Andrew Morton
On Mon, 11 May 2015 19:57:22 +0200 Denys Vlasenko wrote: > With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline > very small functions we expect to be inlined. In particular, > with this config: http://busybox.net/~vda/kernel_config > there are more than a thousand copies of

Re: [PATCH] force inlining of spinlock ops

2015-05-11 Thread Josh Triplett
On Mon, May 11, 2015 at 07:57:22PM +0200, Denys Vlasenko wrote: > With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline > very small functions we expect to be inlined. In particular, > with this config: http://busybox.net/~vda/kernel_config > there are more than a thousand

[PATCH] force inlining of spinlock ops

2015-05-11 Thread Denys Vlasenko
With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline very small functions we expect to be inlined. In particular, with this config: http://busybox.net/~vda/kernel_config there are more than a thousand copies of tiny spinlock-related functions: $ nm --size-sort vmlinux | grep

Re: [PATCH] force inlining of spinlock ops

2015-05-11 Thread Josh Triplett
On Mon, May 11, 2015 at 07:57:22PM +0200, Denys Vlasenko wrote: With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline very small functions we expect to be inlined. In particular, with this config: http://busybox.net/~vda/kernel_config there are more than a thousand copies of

Re: [PATCH] force inlining of spinlock ops

2015-05-11 Thread Andrew Morton
On Mon, 11 May 2015 19:57:22 +0200 Denys Vlasenko dvlas...@redhat.com wrote: With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline very small functions we expect to be inlined. In particular, with this config: http://busybox.net/~vda/kernel_config there are more than a

[PATCH] force inlining of spinlock ops

2015-05-11 Thread Denys Vlasenko
With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously doesn't inline very small functions we expect to be inlined. In particular, with this config: http://busybox.net/~vda/kernel_config there are more than a thousand copies of tiny spinlock-related functions: $ nm --size-sort vmlinux | grep