public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] random: reorder struct entropy_store to remove padding on 64bits
@ 2010-07-28  9:32 Richard Kennedy
  2010-07-28 16:02 ` Matt Mackall
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Kennedy @ 2010-07-28  9:32 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Herbert Xu, Andrew Morton, lkml

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.

Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>

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

regards
Richard



diff --git a/drivers/char/random.c b/drivers/char/random.c
index 8d85587..caef35a 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -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;



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

* Re: [PATCH] random: reorder struct entropy_store to remove padding on 64bits
  2010-07-28  9:32 [PATCH] random: reorder struct entropy_store to remove padding on 64bits Richard Kennedy
@ 2010-07-28 16:02 ` Matt Mackall
  2010-07-31 11:58   ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Mackall @ 2010-07-28 16:02 UTC (permalink / raw)
  To: Richard Kennedy; +Cc: Herbert Xu, Andrew Morton, lkml

On Wed, 2010-07-28 at 10:32 +0100, Richard Kennedy wrote:
> 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. 

> Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>

Signed-off-by: Matt Mackall <mpm@selenic.com>

-- 
Mathematics is the supreme nostalgia of our time.



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

* Re: [PATCH] random: reorder struct entropy_store to remove padding on 64bits
  2010-07-28 16:02 ` Matt Mackall
@ 2010-07-31 11:58   ` Herbert Xu
  2010-07-31 13:36     ` Matt Mackall
  0 siblings, 1 reply; 5+ messages in thread
From: Herbert Xu @ 2010-07-31 11:58 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Richard Kennedy, Andrew Morton, lkml

On Wed, Jul 28, 2010 at 11:02:28AM -0500, Matt Mackall wrote:
> On Wed, 2010-07-28 at 10:32 +0100, Richard Kennedy wrote:
> > 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. 
> 
> > Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
> 
> Signed-off-by: Matt Mackall <mpm@selenic.com>

Patch applied.  Thanks!
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [PATCH] random: reorder struct entropy_store to remove padding on 64bits
  2010-07-31 11:58   ` Herbert Xu
@ 2010-07-31 13:36     ` Matt Mackall
  2010-07-31 15:14       ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Mackall @ 2010-07-31 13:36 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Richard Kennedy, Andrew Morton, lkml

On Sat, 2010-07-31 at 19:58 +0800, Herbert Xu wrote:
> On Wed, Jul 28, 2010 at 11:02:28AM -0500, Matt Mackall wrote:
> > On Wed, 2010-07-28 at 10:32 +0100, Richard Kennedy wrote:
> > > 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. 
> > 
> > > Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
> > 
> > Signed-off-by: Matt Mackall <mpm@selenic.com>
> 
> 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.

-- 
Mathematics is the supreme nostalgia of our time.



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

* Re: [PATCH] random: reorder struct entropy_store to remove padding on 64bits
  2010-07-31 13:36     ` Matt Mackall
@ 2010-07-31 15:14       ` Herbert Xu
  0 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2010-07-31 15:14 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Richard Kennedy, Andrew Morton, lkml

On Sat, Jul 31, 2010 at 08:36:32AM -0500, Matt Mackall wrote:
>
> 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,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2010-07-31 15:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-28  9:32 [PATCH] random: reorder struct entropy_store to remove padding on 64bits Richard Kennedy
2010-07-28 16:02 ` Matt Mackall
2010-07-31 11:58   ` Herbert Xu
2010-07-31 13:36     ` Matt Mackall
2010-07-31 15:14       ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox