lkml.org 
[lkml]   [2004]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Fw: potential /dev/urandom scalability improvement
On Thu, Mar 25, 2004 at 08:51:54PM -0800, David Mosberger wrote:
> >>>>> On Thu, 25 Mar 2004 22:19:26 -0600, Matt Mackall <mpm@selenic.com> said:
>
> > struct entropy_store {
> > + /* mostly-read data: */
> > + struct poolinfo poolinfo;
> > + __u32 *pool;
> > +
> > + /* read-write data: */
> > + spinlock_t lock ____cacheline_aligned;
> > unsigned add_ptr;
> > int entropy_count;
> > int input_rotate;
> > - struct poolinfo poolinfo;
> > - __u32 *pool;
> > - spinlock_t lock;
> > };
>
> Matt> Also, I think in general we'd prefer to stick the aligned bit at the
> Matt> front of the structure rather than at the middle, as we'll avoid extra
> Matt> padding. The size of cachelines is getting rather obscene on some
> Matt> modern processors.
>
> Not sharing the cacheline between the mostly-read data and the
> read-write data is the _point_ of this change. If you reverse the
> order, the "poolinfo" and "pool" members will also get invalidated
> whenever someone updates the write-intensive data.

Ok, previous observation made no sense; I should really be taking a
nap right now. Hopefully this next one will make more sense: it ought
to be ____cacheline_aligned_in_smp as the zero-byte spinlock struct
still forces alignment.

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

\
 
 \ /
  Last update: 2005-03-22 14:01    [W:0.047 / U:1.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site