mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
futex: Unbreak futex hashing
commit8d67743653
upstream. The recent futex inode life time fix changed the ordering of the futex key union struct members, but forgot to adjust the hash function accordingly, As a result the hashing omits the leading 64bit and even hashes beyond the futex key causing a bad hash distribution which led to a ~100% performance regression. Hand in the futex key pointer instead of a random struct member and make the size calculation based of the struct offset. Fixes:8019ad13ef
("futex: Fix inode life-time issue") Reported-by: Rong Chen <rong.a.chen@intel.com> Decoded-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Rong Chen <rong.a.chen@intel.com> Link: https://lkml.kernel.org/r/87h7yy90ve.fsf@nanos.tec.linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
553d46b07d
commit
163489b643
1 changed files with 2 additions and 2 deletions
|
@ -385,9 +385,9 @@ static inline int hb_waiters_pending(struct futex_hash_bucket *hb)
|
||||||
*/
|
*/
|
||||||
static struct futex_hash_bucket *hash_futex(union futex_key *key)
|
static struct futex_hash_bucket *hash_futex(union futex_key *key)
|
||||||
{
|
{
|
||||||
u32 hash = jhash2((u32*)&key->both.word,
|
u32 hash = jhash2((u32 *)key, offsetof(typeof(*key), both.offset) / 4,
|
||||||
(sizeof(key->both.word)+sizeof(key->both.ptr))/4,
|
|
||||||
key->both.offset);
|
key->both.offset);
|
||||||
|
|
||||||
return &futex_queues[hash & (futex_hashsize - 1)];
|
return &futex_queues[hash & (futex_hashsize - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue