Skip to content

Commit

Permalink
MDEV-14529 - InnoDB rw-locks: optimize memory barriers
Browse files Browse the repository at this point in the history
Relax memory barrier for waiters: these 2 stores must be completed before
os_event_set() finishes. This is guaranteed by RELEASE barrier issued by
mutex.exit() of os_event_set().
  • Loading branch information
svoj committed Dec 8, 2017
1 parent 5b624f0 commit 51bb18f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions storage/innobase/include/sync0rw.ic
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,8 @@ rw_lock_x_unlock_func(
exist when there is a writer. */
if (my_atomic_load32_explicit(&lock->waiters,
MY_MEMORY_ORDER_RELAXED)) {
my_atomic_store32((int32*) &lock->waiters, 0);
my_atomic_store32_explicit(&lock->waiters, 0,
MY_MEMORY_ORDER_RELAXED);
os_event_set(lock->event);
sync_array_object_signalled();
}
Expand Down Expand Up @@ -474,7 +475,8 @@ rw_lock_sx_unlock_func(
holder. */
if (my_atomic_load32_explicit(&lock->waiters,
MY_MEMORY_ORDER_RELAXED)) {
my_atomic_store32((int32*) &lock->waiters, 0);
my_atomic_store32_explicit(&lock->waiters, 0,
MY_MEMORY_ORDER_RELAXED);
os_event_set(lock->event);
sync_array_object_signalled();
}
Expand Down

0 comments on commit 51bb18f

Please sign in to comment.