From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751746AbdG1Jej (ORCPT ); Fri, 28 Jul 2017 05:34:39 -0400 Received: from mx2.suse.de ([195.135.220.15]:44411 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751607AbdG1Jei (ORCPT ); Fri, 28 Jul 2017 05:34:38 -0400 Subject: Re: [PATCH] xen: selfballoon: remove unnecessary static in frontswap_selfshrink() To: "Gustavo A. R. Silva" , Boris Ostrovsky Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org References: <20170704183404.GA13813@embeddedgus> From: Juergen Gross Message-ID: <1ec3c66b-9bd2-978d-250e-369a7cea13c8@suse.com> Date: Fri, 28 Jul 2017 11:34:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170704183404.GA13813@embeddedgus> Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Committed to xen/tip.git for-linus-4.13b Thanks, Juergen