Re: Fw: potential /dev/urandom scalability improvement

From: Matt Mackall
Date: Thu Mar 25 2004 - 23:21:51 EST


On Thu, Mar 25, 2004 at 06:00:14PM -0800, Andrew Morton wrote:
>
> 25-akpm/drivers/char/random.c | 51 ++++++++++++++++++++++++++-------------
> 25-akpm/include/linux/prefetch.h | 11 ++++++++
> 2 files changed, 46 insertions(+), 16 deletions(-)
>
> diff -puN drivers/char/random.c~urandom-scalability-fix drivers/char/random.c
> +++ 25-akpm/drivers/char/random.c 2004-03-25 17:57:39.795881168 -0800
> @@ -490,12 +490,15 @@ static inline __u32 int_ln_12bits(__u32
> **********************************************************************/
>
> 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;
> };


Also, I think in general we'd prefer to stick the aligned bit at the
front of the structure rather than at the middle, as we'll avoid extra
padding. The size of cachelines is getting rather obscene on some
modern processors.

--
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/