Skip to content

Commit 0399373

Browse files
GustavoARSilvajgross1
authored andcommitted
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 Signed-off-by: Gustavo A. R. Silva <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent d02ca07 commit 0399373

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/xen/xen-selfballoon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ static unsigned long frontswap_inertia_counter;
151151
static void frontswap_selfshrink(void)
152152
{
153153
static unsigned long cur_frontswap_pages;
154-
static unsigned long last_frontswap_pages;
155-
static unsigned long tgt_frontswap_pages;
154+
unsigned long last_frontswap_pages;
155+
unsigned long tgt_frontswap_pages;
156156

157157
last_frontswap_pages = cur_frontswap_pages;
158158
cur_frontswap_pages = frontswap_curr_pages();

0 commit comments

Comments
 (0)