diff options
Diffstat (limited to 'kernel/lockdep.c')
-rw-r--r-- | kernel/lockdep.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index a796f1f38ac5..7553a28b99cd 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -1459,7 +1459,7 @@ out_bug: | |||
1459 | 1459 | ||
1460 | unsigned long nr_lock_chains; | 1460 | unsigned long nr_lock_chains; |
1461 | struct lock_chain lock_chains[MAX_LOCKDEP_CHAINS]; | 1461 | struct lock_chain lock_chains[MAX_LOCKDEP_CHAINS]; |
1462 | atomic_t nr_chain_hlocks; | 1462 | int nr_chain_hlocks; |
1463 | static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS]; | 1463 | static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS]; |
1464 | 1464 | ||
1465 | struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i) | 1465 | struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i) |
@@ -1481,7 +1481,7 @@ static inline int lookup_chain_cache(struct task_struct *curr, | |||
1481 | struct list_head *hash_head = chainhashentry(chain_key); | 1481 | struct list_head *hash_head = chainhashentry(chain_key); |
1482 | struct lock_chain *chain; | 1482 | struct lock_chain *chain; |
1483 | struct held_lock *hlock_curr, *hlock_next; | 1483 | struct held_lock *hlock_curr, *hlock_next; |
1484 | int i, j, n; | 1484 | int i, j, n, cn; |
1485 | 1485 | ||
1486 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) | 1486 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) |
1487 | return 0; | 1487 | return 0; |
@@ -1540,9 +1540,15 @@ cache_hit: | |||
1540 | } | 1540 | } |
1541 | i++; | 1541 | i++; |
1542 | chain->depth = curr->lockdep_depth + 1 - i; | 1542 | chain->depth = curr->lockdep_depth + 1 - i; |
1543 | n = atomic_add_return(chain->depth, &nr_chain_hlocks); | 1543 | cn = nr_chain_hlocks; |
1544 | if (unlikely(n < MAX_LOCKDEP_CHAIN_HLOCKS)) { | 1544 | while (cn + chain->depth <= MAX_LOCKDEP_CHAIN_HLOCKS) { |
1545 | chain->base = n - chain->depth; | 1545 | n = cmpxchg(&nr_chain_hlocks, cn, cn + chain->depth); |
1546 | if (n == cn) | ||
1547 | break; | ||
1548 | cn = n; | ||
1549 | } | ||
1550 | if (likely(cn + chain->depth <= MAX_LOCKDEP_CHAIN_HLOCKS)) { | ||
1551 | chain->base = cn; | ||
1546 | for (j = 0; j < chain->depth - 1; j++, i++) { | 1552 | for (j = 0; j < chain->depth - 1; j++, i++) { |
1547 | int lock_id = curr->held_locks[i].class - lock_classes; | 1553 | int lock_id = curr->held_locks[i].class - lock_classes; |
1548 | chain_hlocks[chain->base + j] = lock_id; | 1554 | chain_hlocks[chain->base + j] = lock_id; |