xen: selfballoon: remove unnecessary static in frontswap_selfshrink()
PATCH 1/1 xen: selfballoon: remove unnecessary static in frontswap_selfshrink()
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
--- drivers/xen/xen-selfballoon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/xen/xen-selfballoon.c +2 -2
@@ -151,8 +151,8 @@ static unsigned long frontswap_inertia_counter;static void frontswap_selfshrink (void ) {static unsigned long cur_frontswap_pages; -static unsigned long last_frontswap_pages; -static unsigned long tgt_frontswap_pages; +unsigned long last_frontswap_pages; +unsigned long tgt_frontswap_pages; last_frontswap_pages = cur_frontswap_pages; cur_frontswap_pages =frontswap_curr_pages ();
Signature · 1 line
2.5.0
Quoted 34 lines · Gustavo A. R. Silva
Remove unnecessary static on local variables
last_frontswap_pagesandtgt_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:
Quoted 8 lines
text data bss dec hex filename 5633 3452 384 9469 24fd drivers/xen/xen-selfballoon.oafter:
text data bss dec hex filename 5576 3308 256 9140 23b4 drivers/xen/xen-selfballoon.oSigned-off-by Gustavo A. R. Silva <[email protected]>
Sorry for late answer,
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 34 lines · Gustavo A. R. Silva
Remove unnecessary static on local variables
last_frontswap_pagesandtgt_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:
Quoted 8 lines
text data bss dec hex filename 5633 3452 384 9469 24fd drivers/xen/xen-selfballoon.oafter:
text data bss dec hex filename 5576 3308 256 9140 23b4 drivers/xen/xen-selfballoon.oSigned-off-by Gustavo A. R. Silva <[email protected]>
Sorry for late answer,
Juergen
Hi Juergen,
Quoted 38 lines · Juergen Gross
Quoted 37 lines · Gustavo A. R. Silva
Remove unnecessary static on local variables
last_frontswap_pagesandtgt_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
Quoted 8 lines
Quoted 5 lines
after:
text data bss dec hex filename 5576 3308 256 9140 23b4 drivers/xen/xen-selfballoon.oSigned-off-by Gustavo A. R. Silva <[email protected]>Reviewed-by Juergen Gross <[email protected]>
Thank you!
Signature · 1 line
Gustavo A. R. Silva
Hi Juergen,
Quoted 38 lines · Juergen Gross
Quoted 37 lines · Gustavo A. R. Silva
Remove unnecessary static on local variables
last_frontswap_pagesandtgt_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
Quoted 8 lines
Quoted 5 lines
after:
text data bss dec hex filename 5576 3308 256 9140 23b4 drivers/xen/xen-selfballoon.oSigned-off-by Gustavo A. R. Silva <[email protected]>Reviewed-by Juergen Gross <[email protected]>
Thank you!
Signature · 6 lines
Gustavo A. R. Silva _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerQuoted 34 lines · Gustavo A. R. Silva
Remove unnecessary static on local variables
last_frontswap_pagesandtgt_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:
Quoted 8 lines
text data bss dec hex filename 5633 3452 384 9469 24fd drivers/xen/xen-selfballoon.oafter:
text data bss dec hex filename 5576 3308 256 9140 23b4 drivers/xen/xen-selfballoon.oSigned-off-by Gustavo A. R. Silva <[email protected]>
Committed to xen/tip.git for-linus-4.13b
Thanks,
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Juergen Gross
maintainerQuoted 34 lines · Gustavo A. R. Silva
Remove unnecessary static on local variables
last_frontswap_pagesandtgt_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:
Quoted 8 lines
text data bss dec hex filename 5633 3452 384 9469 24fd drivers/xen/xen-selfballoon.oafter:
text data bss dec hex filename 5576 3308 256 9140 23b4 drivers/xen/xen-selfballoon.oSigned-off-by Gustavo A. R. Silva <[email protected]>
Committed to xen/tip.git for-linus-4.13b
Thanks,
Juergen