Re: [patch 2/7] lib/hashmod: Add modulo based hash mechanism
From: Linus Torvalds
Date: Sat May 14 2016 - 14:35:31 EST
On Fri, May 13, 2016 at 8:54 PM, George Spelvin <linux@xxxxxxxxxxx> wrote:
>
> There are exactly three architectures which (some models) don't have
> an efficient 32x32->32-bit multiply:
>
> - arch/m58k: MC68000 (and 68010 and 68328) no-mmu
> - arch/h8300: Most (all?) of the H8 processor series
> - arch/microblaze: Depending on Verilog compilation options
I wouldn't worry about it too much.
The architectures where performance really matters are x86, ARM and powerpc.
The rest need to *work* and not suck horribly, but we're not going to
try to do cycle counting for them. It's not worth the pain.
If an architecture doesn't have a barrel shifter, it's not going to
have fast hash functions.
So I'd be ok with just saying "32-bit architectures are going to use a
multiply with non-sparse bits". Not a problem.
We do want to make sure that hash_64 isn't totally disgusting on
32-bit architectures (but that's a fairly rare case), so we probably
do want to have that function fall back on something else than a 64x64
multiply on a 32-bit architecture. Presumably just "mix the two 32-bit
words into one, then use hash_32() on that" is good enough.
Linus