From: Gregory Haskins Date: Wed, 31 Oct 2007 15:44:05 +0000 (-0400) Subject: lockdep: fix mismatched lockdep_depth/curr_chain_hash X-Git-Tag: v2.6.22.11~1 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=8aa78d8d9e98513a529f99f12cfd577531021f9b;p=karo-tx-linux.git lockdep: fix mismatched lockdep_depth/curr_chain_hash patch 3aa416b07f0adf01c090baab26fb70c35ec17623 in mainline. lockdep: fix mismatched lockdep_depth/curr_chain_hash It is possible for the current->curr_chain_key to become inconsistent with the current index if the chain fails to validate. The end result is that future lock_acquire() operations may inadvertently fail to find a hit in the cache resulting in a new node being added to the graph for every acquire. [ peterz: this might explain some of the lockdep is so _slow_ complaints. ] [ mingo: this does not impact the correctness of validation, but may slow down future operations significantly, if the chain gets very long. ] Signed-off-by: Gregory Haskins Signed-off-by: Peter Zijlstra Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 1a5ff2211d88..072cf2533251 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c @@ -2166,7 +2166,6 @@ out_calc_hash: } #endif chain_key = iterate_chain_key(chain_key, id); - curr->curr_chain_key = chain_key; /* * Trylock needs to maintain the stack of held locks, but it @@ -2215,6 +2214,7 @@ out_calc_hash: if (unlikely(!debug_locks)) return 0; + curr->curr_chain_key = chain_key; curr->lockdep_depth++; check_chain_key(curr); #ifdef CONFIG_DEBUG_LOCKDEP