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


Groups > linux.kernel > #1737597 > unrolled thread

[PATCH] hv_netvsc: make const array ver_list static, reduces object code size

Started byColin King <colin.king@canonical.com>
First post2017-09-22 18:00 +0200
Last post2017-09-26 01:30 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] hv_netvsc:  make const array ver_list static, reduces object code size Colin King <colin.king@canonical.com> - 2017-09-22 18:00 +0200
    RE: [PATCH] hv_netvsc:  make const array ver_list static, reduces  object code size Haiyang Zhang <haiyangz@microsoft.com> - 2017-09-22 18:10 +0200
    Re: [PATCH] hv_netvsc: make const array ver_list static, reduces  object code size David Miller <davem@davemloft.net> - 2017-09-26 01:30 +0200

#1737597 — [PATCH] hv_netvsc: make const array ver_list static, reduces object code size

FromColin King <colin.king@canonical.com>
Date2017-09-22 18:00 +0200
Subject[PATCH] hv_netvsc: make const array ver_list static, reduces object code size
Message-ID<usywW-7Vf-23@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

Don't populate const array ver_list on the stack, instead make it
static. Makes the object code smaller by over 400 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  18444	   3168	    320	  21932	   55ac	drivers/net/hyperv/netvsc.o

After:
   text	   data	    bss	    dec	    hex	filename
  17950	   3224	    320	  21494	   53f6	drivers/net/hyperv/netvsc.o

(gcc 6.3.0, x86-64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/hyperv/netvsc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 8d5077fb0492..b0d323e24978 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -484,7 +484,7 @@ static int netvsc_connect_vsp(struct hv_device *device,
 			      struct netvsc_device *net_device,
 			      const struct netvsc_device_info *device_info)
 {
-	const u32 ver_list[] = {
+	static const u32 ver_list[] = {
 		NVSP_PROTOCOL_VERSION_1, NVSP_PROTOCOL_VERSION_2,
 		NVSP_PROTOCOL_VERSION_4, NVSP_PROTOCOL_VERSION_5
 	};
-- 
2.14.1

[toc] | [next] | [standalone]


#1737601 — RE: [PATCH] hv_netvsc: make const array ver_list static, reduces object code size

FromHaiyang Zhang <haiyangz@microsoft.com>
Date2017-09-22 18:10 +0200
SubjectRE: [PATCH] hv_netvsc: make const array ver_list static, reduces object code size
Message-ID<usyGB-8dH-9@gated-at.bofh.it>
In reply to#1737597

> -----Original Message-----
> From: Colin King [mailto:colin.king@canonical.com]
> Sent: Friday, September 22, 2017 8:50 AM
> To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; Stephen Hemminger <sthemmin@microsoft.com>;
> devel@linuxdriverproject.org; netdev@vger.kernel.org
> Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] hv_netvsc: make const array ver_list static, reduces
> object code size
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate const array ver_list on the stack, instead make it
> static. Makes the object code smaller by over 400 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   18444	   3168	    320	  21932	   55ac
> 	drivers/net/hyperv/netvsc.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   17950	   3224	    320	  21494	   53f6
> 	drivers/net/hyperv/netvsc.o
> 
> (gcc 6.3.0, x86-64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---

Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>


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


#1739357 — Re: [PATCH] hv_netvsc: make const array ver_list static, reduces object code size

FromDavid Miller <davem@davemloft.net>
Date2017-09-26 01:30 +0200
SubjectRe: [PATCH] hv_netvsc: make const array ver_list static, reduces object code size
Message-ID<utKZ4-4P8-23@gated-at.bofh.it>
In reply to#1737597
From: Colin King <colin.king@canonical.com>
Date: Fri, 22 Sep 2017 16:50:23 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate const array ver_list on the stack, instead make it
> static. Makes the object code smaller by over 400 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   18444	   3168	    320	  21932	   55ac	drivers/net/hyperv/netvsc.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   17950	   3224	    320	  21494	   53f6	drivers/net/hyperv/netvsc.o
> 
> (gcc 6.3.0, x86-64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied to net-next, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web