Commit dfaaf3fa authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

locking/lockdep: Use __jhash_mix() for iterate_chain_key()

Use __jhash_mix() to mix the class_idx into the class_key. This
function provides better mixing than the previously used, home grown
mix function.

Leave hashing to the professionals :-)
Suggested-by: default avatarGeorge Spelvin <linux@sciencehorizons.net>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent ed8ebd1d
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/kmemcheck.h> #include <linux/kmemcheck.h>
#include <linux/random.h> #include <linux/random.h>
#include <linux/jhash.h>
#include <asm/sections.h> #include <asm/sections.h>
...@@ -309,10 +310,14 @@ static struct hlist_head chainhash_table[CHAINHASH_SIZE]; ...@@ -309,10 +310,14 @@ static struct hlist_head chainhash_table[CHAINHASH_SIZE];
* It's a 64-bit hash, because it's important for the keys to be * It's a 64-bit hash, because it's important for the keys to be
* unique. * unique.
*/ */
#define iterate_chain_key(key1, key2) \ static inline u64 iterate_chain_key(u64 key, u32 idx)
(((key1) << MAX_LOCKDEP_KEYS_BITS) ^ \ {
((key1) >> (64-MAX_LOCKDEP_KEYS_BITS)) ^ \ u32 k0 = key, k1 = key >> 32;
(key2))
__jhash_mix(idx, k0, k1); /* Macro that modifies arguments! */
return k0 | (u64)k1 << 32;
}
void lockdep_off(void) void lockdep_off(void)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment