aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2016-05-30 12:31:33 -0400
committerIngo Molnar <mingo@kernel.org>2016-06-08 08:22:00 -0400
commitdfaaf3fa01d65cf6e2072965bb0b7aaa7285344f (patch)
treee2b993df8b9fd932668875f3f985beadecd12f9e
parented8ebd1d514126c0e54fbdbd231427dc91c877c2 (diff)
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: George Spelvin <linux@sciencehorizons.net> Signed-off-by: Peter 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: Ingo Molnar <mingo@kernel.org>
-rw-r--r--kernel/locking/lockdep.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 81f1a7107c0e..589d763a49b3 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -46,6 +46,7 @@
46#include <linux/gfp.h> 46#include <linux/gfp.h>
47#include <linux/kmemcheck.h> 47#include <linux/kmemcheck.h>
48#include <linux/random.h> 48#include <linux/random.h>
49#include <linux/jhash.h>
49 50
50#include <asm/sections.h> 51#include <asm/sections.h>
51 52
@@ -309,10 +310,14 @@ static struct hlist_head chainhash_table[CHAINHASH_SIZE];
309 * It's a 64-bit hash, because it's important for the keys to be 310 * It's a 64-bit hash, because it's important for the keys to be
310 * unique. 311 * unique.
311 */ 312 */
312#define iterate_chain_key(key1, key2) \ 313static inline u64 iterate_chain_key(u64 key, u32 idx)
313 (((key1) << MAX_LOCKDEP_KEYS_BITS) ^ \ 314{
314 ((key1) >> (64-MAX_LOCKDEP_KEYS_BITS)) ^ \ 315 u32 k0 = key, k1 = key >> 32;
315 (key2)) 316
317 __jhash_mix(idx, k0, k1); /* Macro that modifies arguments! */
318
319 return k0 | (u64)k1 << 32;
320}
316 321
317void lockdep_off(void) 322void lockdep_off(void)
318{ 323{