netdev
[Top] [All Lists]

Re: [RFC] enhanced version of net_random()

To: Andreas Dilger <adilger@xxxxxxxxxxxxx>
Subject: Re: [RFC] enhanced version of net_random()
From: "Richard B. Johnson" <root@xxxxxxxxxxxxxxxxxx>
Date: Fri, 20 Aug 2004 15:22:09 -0400 (EDT)
Cc: Jean-Luc Cooke <jlcooke@xxxxxxxxxxxxxx>, Stephen Hemminger <shemminger@xxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxx>, Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>, "Theodore Ts'o" <tytso@xxxxxxx>, netdev@xxxxxxxxxxx, Linux kernel <linux-kernel@xxxxxxxxxxxxxxx>
In-reply-to: <20040820185956.GV8967@xxxxxxxxxxxxxxxxxxxx>
References: <20040812104835.3b179f5a@xxxxxxxxxxxxxxxxxxxxx> <20040820175952.GI5806@xxxxxxxxxxxxxx> <20040820185956.GV8967@xxxxxxxxxxxxxxxxxxxx>
Reply-to: root@xxxxxxxxxxxxxxxxxx
Sender: netdev-bounce@xxxxxxxxxxx
On Fri, 20 Aug 2004, Andreas Dilger wrote:

> On Aug 20, 2004  13:59 -0400, Jean-Luc Cooke wrote:
> > Is there a reason why get_random_bytes() is unsuitable?
> >
> > Keeping the number of PRNGs in the kernel to a minimum should a goal we can
> > all share.
>
> For some uses a decent PRNG is enough, and the overhead of get_random_bytes()
> is much too high.  We've needed something like this for a long time (something
> that gives decenly uniform numbers) and hacks to use useconds/cycles/etc do
> not cut it.  I for one welcome a simple in-kernel interface to
> e.g. get_urandom_bytes() (or net_random() as this is maybe inappropriately
> called) that is only pseudo-random but fast and efficient.
>
> Cheers, Andreas
> --
> Andreas Dilger

The attached code will certainly work on Intel machines. It is
in the public domain, having been modified by myself to produce
a very long sequence...

I wouldn't suggest converting it to 'C' because the rotation
takes many CPU instructions when one tries to do the test, shift,
and OR in 'C',

Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
            Note 96.31% of all statistics are fiction.

Attachment: rnd.S
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>