Re: [RFC] frandom - fast random generator module

From: Matt Mackall
Date: Thu Oct 16 2003 - 15:38:49 EST


On Thu, Oct 16, 2003 at 02:27:06PM -0600, Andreas Dilger wrote:
> On Oct 16, 2003 14:08 -0500, Matt Mackall wrote:
> > On Thu, Oct 16, 2003 at 12:38:28PM -0600, Andreas Dilger wrote:
> > > It was a 2-way SMP system. We use the RNG a fair amount (enough to know
> > > that 2 CPUs can race and return the same value from get_random_bytes() ;-)
> >
> > Sure this is a race and not a birthday paradox? How recent is this?
> > Possibly before locking was added to random.c?
>
> This is with a 2.4 kernel, which AFAIK doesn't have any locking.

Correct.

> > > so we had to put a spinlock around our calls to that. Even so, oprofile
> > > showed extract_entropy() and SHATransform() near the top of CPU users.
> >
> > Ok, the lock contention would be with add_entropy_words. I've got code
> > that reduces calls to SHATransform for /dev/urandom, but it require
> > addressing the starvation issues between /dev/random and /dev/urandom first.
>
> But there isn't an in-kernel interface to "/dev/urandom" so that doesn't
> help us.

There is, it's called get_random_bytes. There's no interface to the
blocking version though.

--
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/