* [PATCH 1/4] brcm80211: deinline brcmf_chip_cr4_enterdl, save 440 bytes
@ 2014-03-30 21:31 Denys Vlasenko
2014-03-30 21:31 ` [PATCH 2/4] brcm80211: deinline dma64_dd_upd, save 157 bytes Denys Vlasenko
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Denys Vlasenko @ 2014-03-30 21:31 UTC (permalink / raw)
To: Franky Lin, Arend van Spriel, Hante Meuleman, John W. Linville,
linux-kernel, linux-wireless
Cc: Denys Vlasenko
Automated script discovered that without forced inlining,
gcc-4.7 generates smaller code for this function.
There is no need to declare static functions inline anyway:
nowadays gcc detects single-callsite static functions
which benefit from inlining.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
drivers/net/wireless/brcm80211/brcmfmac/chip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
index df130ef..d020b0b 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
@@ -933,7 +933,7 @@ static bool brcmf_chip_cm3_exitdl(struct brcmf_chip_priv *chip)
return true;
}
-static inline void
+static void
brcmf_chip_cr4_enterdl(struct brcmf_chip_priv *chip)
{
struct brcmf_core *core;
--
1.8.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] brcm80211: deinline dma64_dd_upd, save 157 bytes
2014-03-30 21:31 [PATCH 1/4] brcm80211: deinline brcmf_chip_cr4_enterdl, save 440 bytes Denys Vlasenko
@ 2014-03-30 21:31 ` Denys Vlasenko
2014-03-30 21:31 ` [PATCH 3/4] brcm80211: deinline wlc_intstatus, save 429 bytes Denys Vlasenko
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Denys Vlasenko @ 2014-03-30 21:31 UTC (permalink / raw)
To: Franky Lin, Arend van Spriel, Hante Meuleman, John W. Linville,
linux-kernel, linux-wireless
Cc: Denys Vlasenko
Automated script discovered that without forced inlining,
gcc-4.7 generates smaller code for this function.
There is no need to declare static functions inline anyway:
nowadays gcc detects single-callsite static functions
which benefit from inlining.
In this case, function is large and has two callsites.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
drivers/net/wireless/brcm80211/brcmsmac/dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
index 4fb9635..5acf73e 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
@@ -711,7 +711,7 @@ struct dma_pub *dma_attach(char *name, struct brcms_c_info *wlc,
return NULL;
}
-static inline void
+static void
dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring,
dma_addr_t pa, uint outidx, u32 *flags, u32 bufcount)
{
--
1.8.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] brcm80211: deinline wlc_intstatus, save 429 bytes
2014-03-30 21:31 [PATCH 1/4] brcm80211: deinline brcmf_chip_cr4_enterdl, save 440 bytes Denys Vlasenko
2014-03-30 21:31 ` [PATCH 2/4] brcm80211: deinline dma64_dd_upd, save 157 bytes Denys Vlasenko
@ 2014-03-30 21:31 ` Denys Vlasenko
2014-03-30 21:31 ` [PATCH 4/4] brcm80211: deinline brcmf_sdio_clrintr, save 8979 bytes Denys Vlasenko
2014-03-31 7:38 ` [PATCH 1/4] brcm80211: deinline brcmf_chip_cr4_enterdl, save 440 bytes Arend van Spriel
3 siblings, 0 replies; 8+ messages in thread
From: Denys Vlasenko @ 2014-03-30 21:31 UTC (permalink / raw)
To: Franky Lin, Arend van Spriel, Hante Meuleman, John W. Linville,
linux-kernel, linux-wireless
Cc: Denys Vlasenko
Automated script discovered that without forced inlining,
gcc-4.7 generates smaller code for this function.
There is no need to declare static functions inline anyway:
nowadays gcc detects single-callsite static functions
which benefit from inlining.
In this case, function is large and has two callsites.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
drivers/net/wireless/brcm80211/brcmsmac/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 9417cb5..fa7bc18 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -2539,7 +2539,7 @@ brcms_c_mute(struct brcms_c_info *wlc, bool mute_tx)
* 0 if the interrupt is not for us, or we are in some special cases;
* device interrupt status bits otherwise.
*/
-static inline u32 wlc_intstatus(struct brcms_c_info *wlc, bool in_isr)
+static u32 wlc_intstatus(struct brcms_c_info *wlc, bool in_isr)
{
struct brcms_hardware *wlc_hw = wlc->hw;
struct bcma_device *core = wlc_hw->d11core;
--
1.8.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] brcm80211: deinline brcmf_sdio_clrintr, save 8979 bytes
2014-03-30 21:31 [PATCH 1/4] brcm80211: deinline brcmf_chip_cr4_enterdl, save 440 bytes Denys Vlasenko
2014-03-30 21:31 ` [PATCH 2/4] brcm80211: deinline dma64_dd_upd, save 157 bytes Denys Vlasenko
2014-03-30 21:31 ` [PATCH 3/4] brcm80211: deinline wlc_intstatus, save 429 bytes Denys Vlasenko
@ 2014-03-30 21:31 ` Denys Vlasenko
2014-03-31 7:38 ` [PATCH 1/4] brcm80211: deinline brcmf_chip_cr4_enterdl, save 440 bytes Arend van Spriel
3 siblings, 0 replies; 8+ messages in thread
From: Denys Vlasenko @ 2014-03-30 21:31 UTC (permalink / raw)
To: Franky Lin, Arend van Spriel, Hante Meuleman, John W. Linville,
linux-kernel, linux-wireless
Cc: Denys Vlasenko
Automated script discovered that without forced inlining,
gcc-4.7 generates smaller code for this function.
There is no need to declare static functions inline anyway:
nowadays gcc detects single-callsite static functions
which benefit from inlining.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
index 47a6f39..55a6d0d 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
@@ -2516,7 +2516,7 @@ static void brcmf_sdio_bus_stop(struct device *dev)
bus->tx_seq = bus->rx_seq = 0;
}
-static inline void brcmf_sdio_clrintr(struct brcmf_sdio *bus)
+static void brcmf_sdio_clrintr(struct brcmf_sdio *bus)
{
unsigned long flags;
--
1.8.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] brcm80211: deinline brcmf_chip_cr4_enterdl, save 440 bytes
2014-03-30 21:31 [PATCH 1/4] brcm80211: deinline brcmf_chip_cr4_enterdl, save 440 bytes Denys Vlasenko
` (2 preceding siblings ...)
2014-03-30 21:31 ` [PATCH 4/4] brcm80211: deinline brcmf_sdio_clrintr, save 8979 bytes Denys Vlasenko
@ 2014-03-31 7:38 ` Arend van Spriel
2014-03-31 11:18 ` Denys Vlasenko
3 siblings, 1 reply; 8+ messages in thread
From: Arend van Spriel @ 2014-03-31 7:38 UTC (permalink / raw)
To: Denys Vlasenko, Franky Lin, Hante Meuleman, John W. Linville,
linux-kernel, linux-wireless
On 30/03/14 23:31, Denys Vlasenko wrote:
> Automated script discovered that without forced inlining,
> gcc-4.7 generates smaller code for this function.
>
> There is no need to declare static functions inline anyway:
> nowadays gcc detects single-callsite static functions
> which benefit from inlining.
These patches look awfully familiar. I tend to object, but I don't know
the details of this automated script. Does it only look for code size.
How about execution time or is this only compile tested? The other thing
is that you seem to rely on a specific gcc version. What about pre-4.7?
How about different architectures. Was this determined on x86, arm,
sparc, mips. All these questions make me say 'nay'.
Regards,
Arend
> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
> ---
> drivers/net/wireless/brcm80211/brcmfmac/chip.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
> index df130ef..d020b0b 100644
> --- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
> +++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
> @@ -933,7 +933,7 @@ static bool brcmf_chip_cm3_exitdl(struct brcmf_chip_priv *chip)
> return true;
> }
>
> -static inline void
> +static void
> brcmf_chip_cr4_enterdl(struct brcmf_chip_priv *chip)
> {
> struct brcmf_core *core;
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] brcm80211: deinline brcmf_chip_cr4_enterdl, save 440 bytes
2014-03-31 7:38 ` [PATCH 1/4] brcm80211: deinline brcmf_chip_cr4_enterdl, save 440 bytes Arend van Spriel
@ 2014-03-31 11:18 ` Denys Vlasenko
2014-03-31 11:19 ` Denys Vlasenko
2014-03-31 13:42 ` Arend van Spriel
0 siblings, 2 replies; 8+ messages in thread
From: Denys Vlasenko @ 2014-03-31 11:18 UTC (permalink / raw)
To: Arend van Spriel, Franky Lin, Hante Meuleman, John W. Linville,
linux-kernel, linux-wireless
On 03/31/2014 09:38 AM, Arend van Spriel wrote:
> On 30/03/14 23:31, Denys Vlasenko wrote:
>> Automated script discovered that without forced inlining,
>> gcc-4.7 generates smaller code for this function.
>>
>> There is no need to declare static functions inline anyway:
>> nowadays gcc detects single-callsite static functions
>> which benefit from inlining.
>
> These patches look awfully familiar. I tend to object, but I don't know the details of this automated script.
The script removes "static" keyword, recompiles the .c file,
compares the sizes, and if code size went down,
creates a patch
> How about execution time or is this only compile tested?
The change adds one pair of call/return instructions -
probably around 5-10 CPU cycles.
The function in question is a part of firmware download logic,
which is nowhere near being hot path/.
> The other thing is that you seem to rely on a specific gcc version.
> What about pre-4.7? How about different architectures.
> Was this determined on x86, arm, sparc, mips.
> All these questions make me say 'nay'.
Not making functions inline unless there is a good reason
is a general good coding practice. It is not a compiler-
or architecture-specific optimization.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] brcm80211: deinline brcmf_chip_cr4_enterdl, save 440 bytes
2014-03-31 11:18 ` Denys Vlasenko
@ 2014-03-31 11:19 ` Denys Vlasenko
2014-03-31 13:42 ` Arend van Spriel
1 sibling, 0 replies; 8+ messages in thread
From: Denys Vlasenko @ 2014-03-31 11:19 UTC (permalink / raw)
To: Arend van Spriel, Franky Lin, Hante Meuleman, John W. Linville,
linux-kernel, linux-wireless
On 03/31/2014 01:18 PM, Denys Vlasenko wrote:
> The script removes "static" keyword, recompiles the .c file,
> compares the sizes, and if code size went down,
> creates a patch
Erm... I meant, "removes 'inline' keyword".
"static", or course, is not removed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] brcm80211: deinline brcmf_chip_cr4_enterdl, save 440 bytes
2014-03-31 11:18 ` Denys Vlasenko
2014-03-31 11:19 ` Denys Vlasenko
@ 2014-03-31 13:42 ` Arend van Spriel
1 sibling, 0 replies; 8+ messages in thread
From: Arend van Spriel @ 2014-03-31 13:42 UTC (permalink / raw)
To: Denys Vlasenko, Franky Lin, Hante Meuleman, John W. Linville,
linux-kernel, linux-wireless
On 31/03/14 13:18, Denys Vlasenko wrote:
> On 03/31/2014 09:38 AM, Arend van Spriel wrote:
>> On 30/03/14 23:31, Denys Vlasenko wrote:
>>> Automated script discovered that without forced inlining,
>>> gcc-4.7 generates smaller code for this function.
>>>
>>> There is no need to declare static functions inline anyway:
>>> nowadays gcc detects single-callsite static functions
>>> which benefit from inlining.
>>
>> These patches look awfully familiar. I tend to object, but I don't know the details of this automated script.
>
> The script removes "static" keyword, recompiles the .c file,
> compares the sizes, and if code size went down,
> creates a patch
>
>> How about execution time or is this only compile tested?
>
> The change adds one pair of call/return instructions -
> probably around 5-10 CPU cycles.
>
> The function in question is a part of firmware download logic,
> which is nowhere near being hot path/.
True. My remarks are on all four patches and I just replied to the first
patch. The other patches are in interrupt handling code, ie. interrupt
or bottom-halve context.
>> The other thing is that you seem to rely on a specific gcc version.
>> What about pre-4.7? How about different architectures.
>> Was this determined on x86, arm, sparc, mips.
>> All these questions make me say 'nay'.
>
> Not making functions inline unless there is a good reason
> is a general good coding practice. It is not a compiler-
> or architecture-specific optimization.
Agree, but you seem to assume that in this case there is no good reason.
Regards,
Arend
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-03-31 13:43 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-30 21:31 [PATCH 1/4] brcm80211: deinline brcmf_chip_cr4_enterdl, save 440 bytes Denys Vlasenko
2014-03-30 21:31 ` [PATCH 2/4] brcm80211: deinline dma64_dd_upd, save 157 bytes Denys Vlasenko
2014-03-30 21:31 ` [PATCH 3/4] brcm80211: deinline wlc_intstatus, save 429 bytes Denys Vlasenko
2014-03-30 21:31 ` [PATCH 4/4] brcm80211: deinline brcmf_sdio_clrintr, save 8979 bytes Denys Vlasenko
2014-03-31 7:38 ` [PATCH 1/4] brcm80211: deinline brcmf_chip_cr4_enterdl, save 440 bytes Arend van Spriel
2014-03-31 11:18 ` Denys Vlasenko
2014-03-31 11:19 ` Denys Vlasenko
2014-03-31 13:42 ` Arend van Spriel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).