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:	Mon, 17 Mar 2014 08:16:05 -0700
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	David Laight <David.Laight@...LAB.COM>
Cc:	Thomas Graf <tgraf@...g.ch>, David Miller <davem@...emloft.net>,
	John Fastabend <john.fastabend@...il.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH net-next] net: sched: use no more than one page in
 struct fw_head

On Mon, 2014-03-17 at 14:29 +0000, David Laight wrote:

> Especially for a modulus operation - which requires a second multiply
> and probably has issues with some large values.
> 
> For a hash you could use '(handle * 0x1ffull) >> 32' to reduce the hash.

Nice try, but this wont work.

Most of the time @handle is a small value, for example in the 0 .. 100
range.


> 
> or use a 'modulo 2^n-1 reduction':
> 	handle = (handle & 0x3ffff) + (handle >> 18);
> 	do
> 		handle = (handle & 0x1ff) + (handle >> 9);
> 	while (handle > 0x1ffu);

All these tricks were needed 20 years ago.

Even Thomas laptop can do a divide faster than this loop.

Let the compiler do the thing itself, it is its job.


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