futex: Unbreak futex hashing
authorThomas Gleixner <tglx@linutronix.de>
Sun, 8 Mar 2020 18:07:17 +0000 (19:07 +0100)
committerPDO SCM Team <hudsoncm@motorola.com>
Wed, 20 Oct 2021 03:00:45 +0000 (22:00 -0500)
commit10887969a11071ece522e6fdd0cc9121b1a637b6
tree58af6dc0e1323b0a6f0b5f335f85dfa8f3688bc4
parentfb3999102be662a76907255d0ca0f18f6861f3af
futex: Unbreak futex hashing

commit 8d67743653dce5a0e7aa500fcccb237cde7ad88e 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: 8019ad13ef7f ("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>
(cherry picked from commit 25963a6606d3180b308425a402075a4bb9d07e01)
Signed-off-by: Gajjala Chakradhar <gajjalac@motorola.com>
Change-Id: I25295391b13ba6e408afccfcd8d35724c94c39e0
Reviewed-on: https://gerrit.mot.com/2085476
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
(cherry picked from commit 1960ccb04d18ca01bac28207884984fd20bf65ea)
kernel/futex.c