lkml.org 
[lkml]   [2004]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: Fw: potential /dev/urandom scalability improvement
>>>>> 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.

--david
-
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.230 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site