From: "tip-bot2 for Thomas Gleixner" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Rong Chen <rong.a.chen@intel.com>,
Thomas Gleixner <tglx@linutronix.de>, x86 <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [tip: locking/urgent] futex: Unbreak futex hashing
Date: Mon, 09 Mar 2020 21:42:08 -0000 [thread overview]
Message-ID: <158379012847.28353.9019650703766565146.tip-bot2@tip-bot2> (raw)
In-Reply-To: <87h7yy90ve.fsf@nanos.tec.linutronix.de>
The following commit has been merged into the locking/urgent branch of tip:
Commit-ID: 8d67743653dce5a0e7aa500fcccb237cde7ad88e
Gitweb: https://git.kernel.org/tip/8d67743653dce5a0e7aa500fcccb237cde7ad88e
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sun, 08 Mar 2020 19:07:17 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 09 Mar 2020 22:33:09 +01:00
futex: Unbreak futex hashing
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
---
kernel/futex.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/futex.c b/kernel/futex.c
index e14f7cd..82dfacb 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -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)
{
- u32 hash = jhash2((u32*)&key->both.word,
- (sizeof(key->both.word)+sizeof(key->both.ptr))/4,
+ u32 hash = jhash2((u32 *)key, offsetof(typeof(*key), both.offset) / 4,
key->both.offset);
+
return &futex_queues[hash & (futex_hashsize - 1)];
}
next prev parent reply other threads:[~2020-03-09 21:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-08 14:02 [futex] 8019ad13ef: will-it-scale.per_process_ops -97.8% regression kernel test robot
[not found] ` <CAHk-=wgJV7xrxsTkOG203huPShzZBEC6N_BG0KGwHBmEq4yqWg@mail.gmail.com>
2020-03-08 15:28 ` Linus Torvalds
2020-03-08 18:07 ` Thomas Gleixner
2020-03-09 8:26 ` kernel test robot
2020-03-09 8:51 ` Peter Zijlstra
2020-03-09 9:34 ` Thomas Gleixner
2020-03-09 21:42 ` tip-bot2 for Thomas Gleixner [this message]
2020-03-11 8:20 ` Thierry Reding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=158379012847.28353.9019650703766565146.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=rong.a.chen@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).