Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp594721pxb; Thu, 19 Aug 2021 06:57:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfXHgypxDtVlxqEIrqgQiAW1UdjILrVdLm46SHnDchJNQFXzOqJZw5GyAo5sTpoFWT93Ow X-Received: by 2002:a17:906:aada:: with SMTP id kt26mr16060631ejb.199.1629381431280; Thu, 19 Aug 2021 06:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629381431; cv=none; d=google.com; s=arc-20160816; b=BtIhQPI70X7kKizr4zGStSUYzRiXnuyhhWr4omYlkpOQ764K9DNE1FNARqdLP4Ubns oqiaDpPoHP6FSFGMH8lymnWzCSMR3XIz/T/Kpbmbkfd+XhQVszowH3zZF3Zg0zv9N8Y5 Zs4e/4Y98BQysQLi2+/0AUmYkOrlcV6edxzTMAF+rrGUEtih9Xn0SCFqW47Sq4FqIKUY V4QYWHskptuhBbUX3X7wgdUtFDlHMBKK5ghRqXrFUN6UfwpdzPmInJKpaAsDplCX+wKL eqvnIOF973Da2dsgNzOHiDaxKofAV5+aoOEx+KRk//QtzLy6qVpUnSScjcvGrjo2G4ww RVaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=qyVfAD70OnSmTL6T7q8M2kzukbFXgV7pw1ZsTuvCXvs=; b=f4mz05Byp90ZemfGinjCuupeiCzbMTfBrpiMErXMV8hpI9yHxGRWYmIhhT19NX3bM5 3gIKV/RP1aOlvq0jB1wJDtgCqFK0hPR9JtvDnvKcq/UalSFoYc0f5LgaBU1FEdtDkE9G TKvK805Bx70CrzOjUCmGmo1Z3XmgBmEXVOP2ZERDqiZ4FgmDL0bVSig0OwdFEn1OBWDG /w0ZcdDK5imFTDx8d+QVnfeDNQatOI1J8cZDH6KCh0R2uknREUZtWEonRdL0R+QMNpiW fLfunE8SfqMRiPW+GonyqyxULT8EUdILKwstscaJNiB35rUXoYQzSvvEtdkemCYFarVc 5ttA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=wWEiWs+2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r2si3236454edo.387.2021.08.19.06.56.43; Thu, 19 Aug 2021 06:57:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=wWEiWs+2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240328AbhHSNzY (ORCPT + 99 others); Thu, 19 Aug 2021 09:55:24 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:43728 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238564AbhHSNzX (ORCPT ); Thu, 19 Aug 2021 09:55:23 -0400 Received: from [10.172.193.212] (1.general.cking.uk.vpn [10.172.193.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 887473F047; Thu, 19 Aug 2021 13:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1629381280; bh=qyVfAD70OnSmTL6T7q8M2kzukbFXgV7pw1ZsTuvCXvs=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=wWEiWs+2aX1SyglCKtylm23g+9P2rxsF9XgIkRI3Ourd3b0qQKSrkO4ltWyqoEdRe 1JnX7dXu6j+Ctid2QwajdijkHBDok0orq+B+vTx99m6KEjxlQko8WdJPbyTZBLEmp2 DUTEuOrLaxRKltOPW+IHwqzXu00bwBcPtABBn/Ou5j5cnvQ6x+B5G/+r8kVde9KRrG AEurGqItIBuoNkK/CSSO1XyflExM+iS/FeCwnmuGRgvj6tbNtnA1ZPF/qZ5ONKumnA MXx9auJcSe/E2UR7j2tPHUfXmbdx8XowwBy2UYMAJ1jT/TI0j7Xtqape/pNr6gF+xb NRIv4pQMEEV3Q== Subject: Re: [PATCH] drm/bridge/tc358767: make the array ext_div static const, makes object smaller To: Joe Perches , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210819133839.10745-1-colin.king@canonical.com> <0a2ea4e54d7bfd61b45cc070eee6b62e8da82190.camel@perches.com> From: Colin Ian King Message-ID: <913b96bc-f5c4-1a26-c5f7-70a9d0ab3f53@canonical.com> Date: Thu, 19 Aug 2021 14:54:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <0a2ea4e54d7bfd61b45cc070eee6b62e8da82190.camel@perches.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/08/2021 14:51, Joe Perches wrote: > On Thu, 2021-08-19 at 14:38 +0100, Colin King wrote: >> From: Colin Ian King >> >> Don't populate the array ext_div on the stack but instead it >> static const. Makes the object code smaller by 118 bytes: >> >> Before: >>    text data bss dec hex filename >>   39449 17500 128 57077 def5 ./drivers/gpu/drm/bridge/tc358767.o >> >> After: >>    text data bss dec hex filename >>   39235 17596 128 56959 de7f ./drivers/gpu/drm/bridge/tc358767.o > > Why is text smaller and data larger with this change? There are less instructions being used with the change since it's not shoving the array data onto the stack at run time. Instead the array is being stored in the data section and there is less object code required to access the data. Colin > >> >> (gcc version 10.3.0) >> >> Signed-off-by: Colin Ian King >> --- >>  drivers/gpu/drm/bridge/tc358767.c | 2 +- >>  1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c >> index 23a6f90b694b..599c23759400 100644 >> --- a/drivers/gpu/drm/bridge/tc358767.c >> +++ b/drivers/gpu/drm/bridge/tc358767.c >> @@ -468,7 +468,7 @@ static int tc_pxl_pll_en(struct tc_data *tc, u32 refclk, u32 pixelclock) >>   int div, best_div = 1; >>   int mul, best_mul = 1; >>   int delta, best_delta; >> - int ext_div[] = {1, 2, 3, 5, 7}; >> + static const int ext_div[] = {1, 2, 3, 5, 7}; >>   int best_pixelclock = 0; >>   int vco_hi = 0; >>   u32 pxl_pllparam; > >