diff options
author | Ingo Molnar <mingo@kernel.org> | 2018-10-23 06:30:19 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2018-10-23 06:30:19 -0400 |
commit | dda93b45389f025fd3422d22cc31cc1ea6040305 (patch) | |
tree | 44a856744843e24ed1baf6ca4edb1be04809a606 /kernel/locking/test-ww_mutex.c | |
parent | 2e62024c265aa69315ed02835623740030435380 (diff) | |
parent | b61b8bba18fe2b63d38fdaf9b83de25e2d787dfe (diff) |
Merge branch 'x86/cache' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/locking/test-ww_mutex.c')
-rw-r--r-- | kernel/locking/test-ww_mutex.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/locking/test-ww_mutex.c b/kernel/locking/test-ww_mutex.c index 0be047dbd897..65a3b7e55b9f 100644 --- a/kernel/locking/test-ww_mutex.c +++ b/kernel/locking/test-ww_mutex.c | |||
@@ -260,7 +260,7 @@ static void test_cycle_work(struct work_struct *work) | |||
260 | { | 260 | { |
261 | struct test_cycle *cycle = container_of(work, typeof(*cycle), work); | 261 | struct test_cycle *cycle = container_of(work, typeof(*cycle), work); |
262 | struct ww_acquire_ctx ctx; | 262 | struct ww_acquire_ctx ctx; |
263 | int err; | 263 | int err, erra = 0; |
264 | 264 | ||
265 | ww_acquire_init(&ctx, &ww_class); | 265 | ww_acquire_init(&ctx, &ww_class); |
266 | ww_mutex_lock(&cycle->a_mutex, &ctx); | 266 | ww_mutex_lock(&cycle->a_mutex, &ctx); |
@@ -270,17 +270,19 @@ static void test_cycle_work(struct work_struct *work) | |||
270 | 270 | ||
271 | err = ww_mutex_lock(cycle->b_mutex, &ctx); | 271 | err = ww_mutex_lock(cycle->b_mutex, &ctx); |
272 | if (err == -EDEADLK) { | 272 | if (err == -EDEADLK) { |
273 | err = 0; | ||
273 | ww_mutex_unlock(&cycle->a_mutex); | 274 | ww_mutex_unlock(&cycle->a_mutex); |
274 | ww_mutex_lock_slow(cycle->b_mutex, &ctx); | 275 | ww_mutex_lock_slow(cycle->b_mutex, &ctx); |
275 | err = ww_mutex_lock(&cycle->a_mutex, &ctx); | 276 | erra = ww_mutex_lock(&cycle->a_mutex, &ctx); |
276 | } | 277 | } |
277 | 278 | ||
278 | if (!err) | 279 | if (!err) |
279 | ww_mutex_unlock(cycle->b_mutex); | 280 | ww_mutex_unlock(cycle->b_mutex); |
280 | ww_mutex_unlock(&cycle->a_mutex); | 281 | if (!erra) |
282 | ww_mutex_unlock(&cycle->a_mutex); | ||
281 | ww_acquire_fini(&ctx); | 283 | ww_acquire_fini(&ctx); |
282 | 284 | ||
283 | cycle->result = err; | 285 | cycle->result = err ?: erra; |
284 | } | 286 | } |
285 | 287 | ||
286 | static int __test_cycle(unsigned int nthreads) | 288 | static int __test_cycle(unsigned int nthreads) |