From patchwork Tue Jul 4 18:34:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 9825491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 16DEB60353 for ; Tue, 4 Jul 2017 18:41:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D20E27C05 for ; Tue, 4 Jul 2017 18:41:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1E7C280FC; Tue, 4 Jul 2017 18:41:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 63BB527C05 for ; Tue, 4 Jul 2017 18:41:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSSj5-0001b5-KT; Tue, 04 Jul 2017 18:39:07 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSSj4-0001ax-69 for xen-devel@lists.xenproject.org; Tue, 04 Jul 2017 18:39:06 +0000 Received: from [85.158.143.35] by server-4.bemta-6.messagelabs.com id E3/11-02962-9C0EB595; Tue, 04 Jul 2017 18:39:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMKsWRWlGSWpSXmKPExsVyYKdRtu6JB9G RBn/OG1p83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBlPHs9gLOjnrbh18BxzA+MDri5GTg4hgfuM Em8vO3QxcgHZXYwSLzu+MEM4lxklHjw7yQhSxSKgInFwSx9QgoODTcBU4vwGUxBTRCBI4utmJ pAKZoEiic8ftjOBhIUFwiV+NIaAhHkFDCTmX1/HCGELSpyc+YQFolxL4sa/l2DlzALSEsv/cY CERYH2XJnwlh3ElhCIkvi7+yoLhG0u8WrWSTYI21ji5asFzBC2lcTvw2tYYOKNa/9D9QpItP0 5yQphy0g8O3EOql5aovHJc0YIm0viwNR5UDP5JQ7PvgcV55PYt3ADVNxMYvfOI1BxNYnNO+ax gpwMMn/VNheIsJvEjYcfmSYwysxC8uQsJE/OQnhyASPzKkaN4tSistQiXSNLvaSizPSMktzEz BxdQwMzvdzU4uLE9NScxKRiveT83E2MwKhlAIIdjAcWBR5ilORgUhLljTWLjhTiS8pPqcxILM 6ILyrNSS0+xCjDwaEkwdtwHygnWJSanlqRlpkDTB8waQkOHiURXoltQGne4oLE3OLMdIjUKUZ jjg2r139h4uh6t/0LkxBLXn5eqpQ4rwnIJAGQ0ozSPLhBsLR2iVFWSpiXEeg0IZ6C1KLczBJU +VeM4hyMSsK8ISBTeDLzSuD2vQI6hQnolIaeCJBTShIRUlINjHIzomY+63wz5/OvtI9vxJzrj h+PC0vY4XK7qvhM5TrehH1hjbsEBO8qZi15pLyc2+B49pXtrHPCBP+WMq5nNOn47aS4sP216d uJMVUdGrsixfxyz7c+e1mue8jU4U1AIO9BCd31HnvXanPzF2dNfZRYmTFl+q6/QjynXf9xTbq ruCFy4owTLUosxRmJhlrMRcWJAPS2/39mAwAA X-Env-Sender: garsilva@embeddedor.com X-Msg-Ref: server-5.tower-21.messagelabs.com!1499193543!63687074!1 X-Originating-IP: [192.185.50.107] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 52357 invoked from network); 4 Jul 2017 18:39:04 -0000 Received: from gateway23.websitewelcome.com (HELO gateway23.websitewelcome.com) (192.185.50.107) by server-5.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 4 Jul 2017 18:39:04 -0000 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 0E01756C36 for ; Tue, 4 Jul 2017 13:34:06 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id SSeidyN2sfhdRSSeiduXaQ; Tue, 04 Jul 2017 13:34:36 -0500 Received: from [189.152.164.199] (port=53564 helo=embeddedgus) by gator4166.hostgator.com with esmtpa (Exim 4.87) (envelope-from ) id 1dSSeD-000ST1-Nj; Tue, 04 Jul 2017 13:34:05 -0500 Date: Tue, 4 Jul 2017 13:34:05 -0500 From: "Gustavo A. R. Silva" To: Boris Ostrovsky , Juergen Gross Message-ID: <20170704183404.GA13813@embeddedgus> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) 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 - lists.xenproject.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.164.199 X-Exim-ID: 1dSSeD-000ST1-Nj X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedgus) [189.152.164.199]:53564 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 3 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= Cc: xen-devel@lists.xenproject.org, "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org Subject: [Xen-devel] [PATCH] xen: selfballoon: remove unnecessary static in frontswap_selfshrink() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/xen/xen-selfballoon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/xen/xen-selfballoon.c b/drivers/xen/xen-selfballoon.c index 6662071..a67e955 100644 --- a/drivers/xen/xen-selfballoon.c +++ b/drivers/xen/xen-selfballoon.c @@ -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();