Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1261324 > unrolled thread

Re: [PATCH 2/5] do_div(): generic optimization for constant divisor on 32-bit machines

Started byArnd Bergmann <arnd@arndb.de>
First post2015-11-03 10:20 +0100
Last post2015-11-04 22:50 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 2/5] do_div(): generic optimization for constant divisor on 32-bit machines Arnd Bergmann <arnd@arndb.de> - 2015-11-03 10:20 +0100
    Re: [PATCH 2/5] do_div(): generic optimization for constant divisor  on 32-bit machines Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-11-04 22:10 +0100
      Re: [PATCH 2/5] do_div(): generic optimization for constant divisor on 32-bit machines Måns Rullgård <mans@mansr.com> - 2015-11-04 22:50 +0100

#1261324 — Re: [PATCH 2/5] do_div(): generic optimization for constant divisor on 32-bit machines

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-03 10:20 +0100
SubjectRe: [PATCH 2/5] do_div(): generic optimization for constant divisor on 32-bit machines
Message-ID<qqFUZ-JW-3@gated-at.bofh.it>
On Tuesday 03 November 2015 13:32:17 kbuild test robot wrote:
> 
>    net/can/bcm.c: In function 'bcm_proc_show':
> >> net/can/bcm.c:223:1: warning: the frame size of 1156 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>     }

Interesting, that is a lot of stack for a function that only has a couple
of local variables:

#define IFNAMSIZ        16
        char ifname[IFNAMSIZ];
        struct sock *sk = (struct sock *)m->private;
        struct bcm_sock *bo = bcm_sk(sk);
        struct bcm_op *op;


This is a parisc-allyesconfig kernel, so I assume that CONFIG_PROFILE_ALL_BRANCHES
is on, which instruments every 'if' in the kernel. If that causes problems,
we could decide to disable the do_div optimization whenever CONFIG_PROFILE_ALL_BRANCHES
is enabled.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1262600 — Re: [PATCH 2/5] do_div(): generic optimization for constant divisor on 32-bit machines

FromNicolas Pitre <nicolas.pitre@linaro.org>
Date2015-11-04 22:10 +0100
SubjectRe: [PATCH 2/5] do_div(): generic optimization for constant divisor on 32-bit machines
Message-ID<qrdtE-5KP-7@gated-at.bofh.it>
In reply to#1261324
On Tue, 3 Nov 2015, Arnd Bergmann wrote:

> On Tuesday 03 November 2015 13:32:17 kbuild test robot wrote:
> > 
> >    net/can/bcm.c: In function 'bcm_proc_show':
> > >> net/can/bcm.c:223:1: warning: the frame size of 1156 bytes is larger than 1024 bytes [-Wframe-larger-than=]
> >     }
> 
> Interesting, that is a lot of stack for a function that only has a couple
> of local variables:
> 
> #define IFNAMSIZ        16
>         char ifname[IFNAMSIZ];
>         struct sock *sk = (struct sock *)m->private;
>         struct bcm_sock *bo = bcm_sk(sk);
>         struct bcm_op *op;
> 
> 
> This is a parisc-allyesconfig kernel, so I assume that CONFIG_PROFILE_ALL_BRANCHES
> is on, which instruments every 'if' in the kernel. If that causes problems,
> we could decide to disable the do_div optimization whenever CONFIG_PROFILE_ALL_BRANCHES
> is enabled.

I have an ARM allyesconfig build here where that function needs a frame 
of 88 bytes only. And that is with my do_div optimization applied.

With the do_div optimization turned off, the stack frame is still 88 
bytes.

Turning on CONFIG_PROFILE_ALL_BRANCHES makes the frame size to grow to 
96 bytes.

Keeping CONFIG_PROFILE_ALL_BRANCHES=y and activating the do_div 
optimization again, and the function frame size goes back to 88 bytes.

So I wonder what parisc gcc could be doing with this code.


Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1262617

FromMåns Rullgård <mans@mansr.com>
Date2015-11-04 22:50 +0100
Message-ID<qre6m-5Zh-29@gated-at.bofh.it>
In reply to#1262600
Nicolas Pitre <nicolas.pitre@linaro.org> writes:

> On Tue, 3 Nov 2015, Arnd Bergmann wrote:
>
>> On Tuesday 03 November 2015 13:32:17 kbuild test robot wrote:
>> > 
>> >    net/can/bcm.c: In function 'bcm_proc_show':
>> > >> net/can/bcm.c:223:1: warning: the frame size of 1156 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>> >     }
>> 
>> Interesting, that is a lot of stack for a function that only has a couple
>> of local variables:
>> 
>> #define IFNAMSIZ        16
>>         char ifname[IFNAMSIZ];
>>         struct sock *sk = (struct sock *)m->private;
>>         struct bcm_sock *bo = bcm_sk(sk);
>>         struct bcm_op *op;
>> 
>> 
>> This is a parisc-allyesconfig kernel, so I assume that CONFIG_PROFILE_ALL_BRANCHES
>> is on, which instruments every 'if' in the kernel. If that causes problems,
>> we could decide to disable the do_div optimization whenever CONFIG_PROFILE_ALL_BRANCHES
>> is enabled.
>
> I have an ARM allyesconfig build here where that function needs a frame 
> of 88 bytes only. And that is with my do_div optimization applied.
>
> With the do_div optimization turned off, the stack frame is still 88 
> bytes.
>
> Turning on CONFIG_PROFILE_ALL_BRANCHES makes the frame size to grow to 
> 96 bytes.
>
> Keeping CONFIG_PROFILE_ALL_BRANCHES=y and activating the do_div 
> optimization again, and the function frame size goes back to 88 bytes.
>
> So I wonder what parisc gcc could be doing with this code.

I've seen parisc gcc do many strange things.

-- 
Måns Rullgård
mans@mansr.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web