[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140317153016.GC8956@casper.infradead.org>
Date: Mon, 17 Mar 2014 15:30:16 +0000
From: Thomas Graf <tgraf@...g.ch>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: David Laight <David.Laight@...LAB.COM>,
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 03/17/14 at 08:16am, Eric Dumazet wrote:
> 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.
So why do we have reciprocal_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