lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 5 Jan 2011 09:17:18 -0800
From:	Stephen Hemminger <shemminger@...tta.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [RFC] sched: CHOKe packet scheduler

On Wed, 05 Jan 2011 07:19:35 +0100
Eric Dumazet <eric.dumazet@...il.com> wrote:

> Le mardi 04 janvier 2011 à 16:29 -0800, Stephen Hemminger a écrit :
> > +static struct sk_buff *skb_peek_random(struct sk_buff_head *list)
> > +{
> > +	struct sk_buff *skb = list->next;
> > +	unsigned int idx = net_random() % list->qlen;
> > +
> > +	while (skb && idx-- > 0)
> > +		skb = skb->next;
> > +
> > +	return skb;
> > +}
> 
> You could avoid the divide op :
> 
> unsigned int idx = reciprocal_divide(random32(), list->qlen);

How would this work, it is a mod not a divide??

-- 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ