Re: Fw: potential /dev/urandom scalability improvement

From: Matt Mackall
Date: Thu Mar 25 2004 - 17:57:04 EST

On Thu, Mar 25, 2004 at 02:19:23PM -0800, Andrew Morton wrote:
> Matt, could you please review David's changes?
> Begin forwarded message:
> Date: Wed, 24 Mar 2004 22:06:57 -0800
> From: David Mosberger <davidm@xxxxxxxxxxxxxxxxx>
> To: akpm@xxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx
> Subject: potential /dev/urandom scalability improvement
> Hi Andrew,
> I'm addressing this patch to you because you seem to have been the
> person who most recently made some performance improvements to the
> random driver.

That was probably me, actually.

> Oh, and somebody who actually understands this code may want to
> double-check the patch for correctness.

Seems perfectly sane.

However, I've got a few pending patches that touch the same areas and
do some more critical cleanup that I've been sitting on since the
2.6.0 freeze. So perhaps I should start pushing those again and we can
queue this behind them. David, if you get a chance, grab the latest
copy of my linux-tiny tree from

and see how I've tweaked the pool structure and the locking and how
your bits fit with it.

> + for (cp = (char *) r->pool; cp <= (char *) (r->pool + wordmask); cp += PREFETCH_STRIDE)
> + prefetch(cp);
> +#endif

Can we avoid adding this ifdef in some fashion? What does the compiler
generate here when prefetch is a no-op? This seems to call for a
prefetch_range(start, len) function/macro in any case.

Matt Mackall : : 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
Please read the FAQ at