diff options
Diffstat (limited to 'kernel/locking')
-rw-r--r-- | kernel/locking/lockdep.c | 11 | ||||
-rw-r--r-- | kernel/locking/test-ww_mutex.c | 6 |
2 files changed, 12 insertions, 5 deletions
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 12e38c213b70..a95e5d1f4a9c 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c | |||
@@ -3262,10 +3262,17 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, | |||
3262 | if (depth) { | 3262 | if (depth) { |
3263 | hlock = curr->held_locks + depth - 1; | 3263 | hlock = curr->held_locks + depth - 1; |
3264 | if (hlock->class_idx == class_idx && nest_lock) { | 3264 | if (hlock->class_idx == class_idx && nest_lock) { |
3265 | if (hlock->references) | 3265 | if (hlock->references) { |
3266 | /* | ||
3267 | * Check: unsigned int references:12, overflow. | ||
3268 | */ | ||
3269 | if (DEBUG_LOCKS_WARN_ON(hlock->references == (1 << 12)-1)) | ||
3270 | return 0; | ||
3271 | |||
3266 | hlock->references++; | 3272 | hlock->references++; |
3267 | else | 3273 | } else { |
3268 | hlock->references = 2; | 3274 | hlock->references = 2; |
3275 | } | ||
3269 | 3276 | ||
3270 | return 1; | 3277 | return 1; |
3271 | } | 3278 | } |
diff --git a/kernel/locking/test-ww_mutex.c b/kernel/locking/test-ww_mutex.c index da6c9a34f62f..6b7abb334ca6 100644 --- a/kernel/locking/test-ww_mutex.c +++ b/kernel/locking/test-ww_mutex.c | |||
@@ -50,7 +50,7 @@ static void test_mutex_work(struct work_struct *work) | |||
50 | 50 | ||
51 | if (mtx->flags & TEST_MTX_TRY) { | 51 | if (mtx->flags & TEST_MTX_TRY) { |
52 | while (!ww_mutex_trylock(&mtx->mutex)) | 52 | while (!ww_mutex_trylock(&mtx->mutex)) |
53 | cpu_relax(); | 53 | cond_resched(); |
54 | } else { | 54 | } else { |
55 | ww_mutex_lock(&mtx->mutex, NULL); | 55 | ww_mutex_lock(&mtx->mutex, NULL); |
56 | } | 56 | } |
@@ -88,7 +88,7 @@ static int __test_mutex(unsigned int flags) | |||
88 | ret = -EINVAL; | 88 | ret = -EINVAL; |
89 | break; | 89 | break; |
90 | } | 90 | } |
91 | cpu_relax(); | 91 | cond_resched(); |
92 | } while (time_before(jiffies, timeout)); | 92 | } while (time_before(jiffies, timeout)); |
93 | } else { | 93 | } else { |
94 | ret = wait_for_completion_timeout(&mtx.done, TIMEOUT); | 94 | ret = wait_for_completion_timeout(&mtx.done, TIMEOUT); |
@@ -627,7 +627,7 @@ static int __init test_ww_mutex_init(void) | |||
627 | if (ret) | 627 | if (ret) |
628 | return ret; | 628 | return ret; |
629 | 629 | ||
630 | ret = stress(4096, hweight32(STRESS_ALL)*ncpus, 1<<12, STRESS_ALL); | 630 | ret = stress(4095, hweight32(STRESS_ALL)*ncpus, 1<<12, STRESS_ALL); |
631 | if (ret) | 631 | if (ret) |
632 | return ret; | 632 | return ret; |
633 | 633 | ||