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


Groups > linux.kernel > #1693450 > unrolled thread

Re: [PATCH] xen: selfballoon: remove unnecessary static in frontswap_selfshrink()

Started byJuergen Gross <jgross@suse.com>
First post2017-07-21 09:40 +0200
Last post2017-07-21 22:50 +0200
Articles 2 — 2 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] xen: selfballoon: remove unnecessary static in  frontswap_selfshrink() Juergen Gross <jgross@suse.com> - 2017-07-21 09:40 +0200
    Re: [PATCH] xen: selfballoon: remove unnecessary static in  frontswap_selfshrink() "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-07-21 22:50 +0200

#1693450 — Re: [PATCH] xen: selfballoon: remove unnecessary static in frontswap_selfshrink()

FromJuergen Gross <jgross@suse.com>
Date2017-07-21 09:40 +0200
SubjectRe: [PATCH] xen: selfballoon: remove unnecessary static in frontswap_selfshrink()
Message-ID<u5AHv-1QX-7@gated-at.bofh.it>
On 04/07/17 20:34, Gustavo A. R. Silva wrote:
> Remove unnecessary static on local variables last_frontswap_pages and
> tgt_frontswap_pages. Such variables are initialized before being used,
> on every execution path throughout the function. The statics have no
> benefit and, removing them reduce the code size.
> 
> This issue was detected using Coccinelle and the following semantic patch:
> 
> @bad exists@
> position p;
> identifier x;
> type T;
> @@
> 
> static T x@p;
> ...
> x = <+...x...+>
> 
> @@
> identifier x;
> expression e;
> type T;
> position p != bad.p;
> @@
> 
> -static
>  T x@p;
>  ... when != x
>      when strict
> ?x = e;
> 
> You can see a significant difference in the code size after executing
> the size command, before and after the code change:
> 
> before:
>    text	   data	    bss	    dec	    hex	filename
>    5633	   3452	    384	   9469	   24fd	drivers/xen/xen-selfballoon.o
> 
> after:
>    text	   data	    bss	    dec	    hex	filename
>    5576	   3308	    256	   9140	   23b4	drivers/xen/xen-selfballoon.o
> 
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Sorry for late answer,

Juergen

[toc] | [next] | [standalone]


#1693973

From"Gustavo A. R. Silva" <garsilva@embeddedor.com>
Date2017-07-21 22:50 +0200
Message-ID<u5N21-136-3@gated-at.bofh.it>
In reply to#1693450
Hi Juergen,

On 07/21/2017 02:36 AM, Juergen Gross wrote:
> On 04/07/17 20:34, Gustavo A. R. Silva wrote:
>> Remove unnecessary static on local variables last_frontswap_pages and
>> tgt_frontswap_pages. Such variables are initialized before being used,
>> on every execution path throughout the function. The statics have no
>> benefit and, removing them reduce the code size.
>>
>> This issue was detected using Coccinelle and the following semantic patch:
>>
>> @bad exists@
>> position p;
>> identifier x;
>> type T;
>> @@
>>
>> static T x@p;
>> ...
>> x = <+...x...+>
>>
>> @@
>> identifier x;
>> expression e;
>> type T;
>> position p != bad.p;
>> @@
>>
>> -static
>>  T x@p;
>>  ... when != x
>>      when strict
>> ?x = e;
>>
>> You can see a significant difference in the code size after executing
>> the size command, before and after the code change:
>>
>> before:
>>    text	   data	    bss	    dec	    hex	filename
>>    5633	   3452	    384	   9469	   24fd	drivers/xen/xen-selfballoon.o
>>
>> after:
>>    text	   data	    bss	    dec	    hex	filename
>>    5576	   3308	    256	   9140	   23b4	drivers/xen/xen-selfballoon.o
>>
>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>
> Reviewed-by: Juergen Gross <jgross@suse.com>
>

Thank you!

-- 
Gustavo A. R. Silva

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web