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: <476539D5.7050305@cosmosbay.com>
Date:	Sun, 16 Dec 2007 15:44:37 +0100
From:	Eric Dumazet <dada1@...mosbay.com>
To:	Adrian Bunk <bunk@...nel.org>
CC:	Matt Mackall <mpm@...enic.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linux kernel <linux-kernel@...r.kernel.org>
Subject: Re: [RANDOM] Move two variables to read_mostly section to save	memory

Adrian Bunk a écrit :
> On Sun, Dec 16, 2007 at 12:45:01PM +0100, Eric Dumazet wrote:
>> While examining vmlinux namelist on i686, I noticed :
>>
>> c0581300 D random_table
>> c0581480 d input_pool
>> c0581580 d random_read_wakeup_thresh
>> c0581584 d random_write_wakeup_thresh
>> c0581600 d blocking_pool
>>
>> That means that the two integers random_read_wakeup_thresh and 
>> random_write_wakeup_thresh use a full cache entry (128 bytes).
>>
>> Moving them to read_mostly section can shrinks vmlinux by 120 bytes.
>>
>> # size vmlinux*
>>    text    data     bss     dec     hex filename
>> 4835553  450210  610304 5896067  59f783 vmlinux.after_patch
>> 4835553  450330  610304 5896187  59f7fb vmlinux.before_patch
>>
>> Signed-off-by: Eric Dumazet <dada1@...mosbay.com>
> 
>> diff --git a/drivers/char/random.c b/drivers/char/random.c
>> index 5fee056..af48e86 100644
>> --- a/drivers/char/random.c
>> +++ b/drivers/char/random.c
>> @@ -256,14 +256,14 @@
>>   * The minimum number of bits of entropy before we wake up a read on
>>   * /dev/random.  Should be enough to do a significant reseed.
>>   */
>> -static int random_read_wakeup_thresh = 64;
>> +static int random_read_wakeup_thresh __read_mostly = 64;
>>  
>>  /*
>>   * If the entropy count falls under this number of bits, then we
>>   * should wake up processes which are selecting or polling on write
>>   * access to /dev/random.
>>   */
>> -static int random_write_wakeup_thresh = 128;
>> +static int random_write_wakeup_thresh __read_mostly = 128;
> 
> Please never ever do such ugly and unmaintainable micro-optimizations in 
> the code unless you can show a measurable performance improvement of the 
> kernel.

You seem to to be confused between speed micro-otimizations and memory 
savings. This patch has nothing to do about a speed optimization. Here, no 
tradeoff justify a "measurable performance improvement" study.

I copied this patch to you because your recent proposal to remove read_mostly 
from linux kernel.

Only you find read_mostly ugly and unmaintanable. I find it way more usefull 
than "static" attributes.

I find 120 bytes is a measurable gain, thank you.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ