Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754492AbdGUUqy (ORCPT ); Fri, 21 Jul 2017 16:46:54 -0400 Received: from gateway32.websitewelcome.com ([192.185.145.122]:36343 "EHLO gateway32.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751996AbdGUUqx (ORCPT ); Fri, 21 Jul 2017 16:46:53 -0400 Subject: Re: [PATCH] xen: selfballoon: remove unnecessary static in frontswap_selfshrink() To: Juergen Gross , Boris Ostrovsky References: <20170704183404.GA13813@embeddedgus> <49a2e01f-7f29-6e29-c5d4-6431218a07f1@suse.com> Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org From: "Gustavo A. R. Silva" Message-ID: Date: Fri, 21 Jul 2017 15:46:46 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <49a2e01f-7f29-6e29-c5d4-6431218a07f1@suse.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.152.228.197 X-Exim-ID: 1dYep1-001aQo-Ts X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.1.208]) [189.152.228.197]:48458 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 4 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1293 Lines: 54 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 > > Reviewed-by: Juergen Gross > Thank you! -- Gustavo A. R. Silva