Skip to contentSkip to conversation

random: reorder struct entropy_store to remove padding on 64bits

PATCH In review Richard Kennedy 3 participants 5 messages Jul 28, 2010 – Jul 31, 2010 Random number driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 random: reorder struct entropy_store to remove padding on 64bits

Re-order structure entropy_store to remove 8 bytes of padding on 64 bit builds, so shrinking this structure from 72 to 64 bytes and allowing it to fit into one cache line.

---
patch against v2.6.35-rc6
built & tested on x86_64

regards
Richard

drivers/char/random.c +1 -1
index 8d85587..caef35a 100644
@@ -407,8 +407,8 @@ struct entropy_store {
 	struct poolinfo *poolinfo;
 	__u32 *pool;
 	const char *name;
-	int limit;
 	struct entropy_store *pull;
+	int limit;
 
 	/* read-write data: */
 	spinlock_t lock;
#1 lore raw
Quoted 3 lines · Richard Kennedy

Re-order structure entropy_store to remove 8 bytes of padding on 64 bit builds, so shrinking this structure from 72 to 64 bytes and allowing it to fit into one cache line.

I have a vague memory that we reordered things so that the r/w bits would be on a separate cache line than the r/o bits. But as we never added the alignment primitives to actually enforce that, I guess it doesn't matter much.

Quoted 1 line
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#2 lore raw
Quoted 5 lines · Matt Mackall
Quoted 3 lines · Richard Kennedy

Re-order structure entropy_store to remove 8 bytes of padding on 64 bit builds, so shrinking this structure from 72 to 64 bytes and allowing it to fit into one cache line.

Quoted 8 lines

I have a vague memory that we reordered things so that the r/w bits would be on a separate cache line than the r/o bits. But as we never added the alignment primitives to actually enforce that, I guess it doesn't matter much.

Quoted 1 line

Patch applied. Thanks!

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#3 lore raw
Quoted 11 lines · Herbert Xu
Quoted 10 lines · Matt Mackall
Quoted 3 lines · Richard Kennedy

Re-order structure entropy_store to remove 8 bytes of padding on 64 bit builds, so shrinking this structure from 72 to 64 bytes and allowing it to fit into one cache line.

I have a vague memory that we reordered things so that the r/w bits would be on a separate cache line than the r/o bits. But as we never added the alignment primitives to actually enforce that, I guess it doesn't matter much.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Patch applied. Thanks!

Oops, I forgot to cc: you on this and Andrew queued it. Andrew, I've been queueing the RNG bits through Herbert's crypto tree lately.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#4 lore raw
Quoted 3 lines · Matt Mackall

Oops, I forgot to cc: you on this and Andrew queued it. Andrew, I've been queueing the RNG bits through Herbert's crypto tree lately.

I think Andrew's scripts are clever enough to remove patches once they show up in another tree.

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt