netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Stephen Hemminger <stephen.hemminger@vyatta.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] SFQ: use net_random
Date: Fri, 18 Jan 2008 20:18:20 -0800	[thread overview]
Message-ID: <20080119041820.GA24840@linux.vnet.ibm.com> (raw)
In-Reply-To: <20080118144730.7878f12a@deepthought>

On Fri, Jan 18, 2008 at 02:47:30PM -0800, Stephen Hemminger wrote:
> SFQ doesn't need true random numbers, it is only using them to salt
> a hash. Therefore it is better to use net_random() and avoid any possible
> problems with depleting the entropy pool.

The random-number algorithm used by net_random() certainly does appear
to be considerably stronger than the one I used to generate the results
in the 1990 paper.  ;-)

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
> 
> 
> --- a/net/sched/sch_sfq.c	2008-01-17 09:00:58.000000000 -0800
> +++ b/net/sched/sch_sfq.c	2008-01-17 09:03:26.000000000 -0800
> @@ -386,7 +386,7 @@ static void sfq_perturbation(unsigned lo
>  	struct Qdisc *sch = (struct Qdisc*)arg;
>  	struct sfq_sched_data *q = qdisc_priv(sch);
> 
> -	get_random_bytes(&q->perturbation, 4);
> +	q->perturbation = net_random();
> 
>  	if (q->perturb_period)
>  		mod_timer(&q->perturb_timer, jiffies + q->perturb_period);
> @@ -415,7 +415,7 @@ static int sfq_change(struct Qdisc *sch,
>  	del_timer(&q->perturb_timer);
>  	if (q->perturb_period) {
>  		mod_timer(&q->perturb_timer, jiffies + q->perturb_period);
> -		get_random_bytes(&q->perturbation, 4);
> +		q->perturbation = net_random();
>  	}
>  	sch_tree_unlock(sch);
>  	return 0;
> @@ -443,7 +443,7 @@ static int sfq_init(struct Qdisc *sch, s
>  	if (opt == NULL) {
>  		q->quantum = psched_mtu(sch->dev);
>  		q->perturb_period = 0;
> -		get_random_bytes(&q->perturbation, 4);
> +		q->perturbation = net_random();
>  	} else {
>  		int err = sfq_change(sch, opt);
>  		if (err)

  parent reply	other threads:[~2008-01-19  4:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080118144309.3530ed2f@deepthought>
     [not found] ` <20080118144730.7878f12a@deepthought>
2008-01-19  0:09   ` [PATCH 3/3] sfq: whitespace cleanup Stephen Hemminger
2008-01-19  4:18   ` Paul E. McKenney [this message]
2008-01-21  1:19     ` [PATCH 2/2] SFQ: use net_random David Miller
     [not found]   ` <20080118144837.0a3593c5@deepthought>
2008-01-21  1:21     ` [PATCH 3/3] sfq: whitespace cleanup David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080119041820.GA24840@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=stephen.hemminger@vyatta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).