Re: Fw: potential /dev/urandom scalability improvement

From: David Mosberger
Date: Thu Mar 25 2004 - 23:53:37 EST


>>>>> On Thu, 25 Mar 2004 22:19:26 -0600, Matt Mackall <mpm@xxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/