Re: [RFC][PATCH] <linux/stringhash.h>: fix end_name_hash() for 64bit long
From: Linus Torvalds
Date: Mon Feb 05 2018 - 12:57:36 EST
On Mon, Feb 5, 2018 at 9:51 AM, Amir Goldstein <amir73il@xxxxxxxxx> wrote:
>
> and hash_32_generic() is just __hash_32() with zero shift.
Right. But that __hash_32() is very expensive and doesn't help.
So the patch as-is doesn't seem to buy anything, and only adds cost.
Note that the dentry code is a bit unusual, in that the final shift is
done later, in d_hash(). And that takes the _high_ bits of the hash,
so unlike a lot of other hash functions, the name hashing doesn't need
to try to spread the bits down to the low bits. The intermediate hash
value should be fine without any extra spreading.
Anyway, we did have numbers at one point. That's what really matters:
how good the actual hashing ends up being. So for me to take the
patch, I would need to see that it actually improves the hash bucket
spreading enough to be worth the cost.
Linus