lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <913b96bc-f5c4-1a26-c5f7-70a9d0ab3f53@canonical.com>
Date:   Thu, 19 Aug 2021 14:54:40 +0100
From:   Colin Ian King <colin.king@...onical.com>
To:     Joe Perches <joe@...ches.com>, Andrzej Hajda <a.hajda@...sung.com>,
        Neil Armstrong <narmstrong@...libre.com>,
        Robert Foss <robert.foss@...aro.org>,
        Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
        Jonas Karlman <jonas@...boo.se>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        dri-devel@...ts.freedesktop.org
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/bridge/tc358767: make the array ext_div static const,
 makes object smaller

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 <colin.king@...onical.com>
>>
>> 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 <colin.king@...onical.com>
>> ---
>>  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;
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ