All of lore.kernel.org
 help / color / mirror / Atom feed
* [RANDOM] Move two variables to read_mostly section to save memory
@ 2007-12-16 11:45 Eric Dumazet
  2007-12-16 13:00 ` Adrian Bunk
  2007-12-16 17:34 ` Matt Mackall
  0 siblings, 2 replies; 11+ messages in thread
From: Eric Dumazet @ 2007-12-16 11:45 UTC (permalink / raw)
  To: Matt Mackall, Andrew Morton; +Cc: Linux kernel, Adrian Bunk

[-- Attachment #1: Type: text/plain, Size: 638 bytes --]

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@cosmosbay.com>

[-- Attachment #2: random_read_mostly.patch --]
[-- Type: text/plain, Size: 762 bytes --]

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;
 
 /*
  * When the input pool goes over trickle_thresh, start dropping most

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-12-17  0:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-16 11:45 [RANDOM] Move two variables to read_mostly section to save memory Eric Dumazet
2007-12-16 13:00 ` Adrian Bunk
2007-12-16 14:44   ` Eric Dumazet
2007-12-16 16:53     ` Adrian Bunk
2007-12-16 17:42       ` Eric Dumazet
2007-12-16 18:14         ` Adrian Bunk
2007-12-16 18:38           ` Eric Dumazet
2007-12-16 19:17             ` Adrian Bunk
2007-12-17  0:33             ` Matt Mackall
2007-12-16 17:34 ` Matt Mackall
2007-12-16 17:56   ` Eric Dumazet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.