Commit 51bb18f9 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-14529 - InnoDB rw-locks: optimize memory barriers

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().
parent 5b624f00
...@@ -420,7 +420,8 @@ rw_lock_x_unlock_func( ...@@ -420,7 +420,8 @@ rw_lock_x_unlock_func(
exist when there is a writer. */ exist when there is a writer. */
if (my_atomic_load32_explicit(&lock->waiters, if (my_atomic_load32_explicit(&lock->waiters,
MY_MEMORY_ORDER_RELAXED)) { 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); os_event_set(lock->event);
sync_array_object_signalled(); sync_array_object_signalled();
} }
...@@ -474,7 +475,8 @@ rw_lock_sx_unlock_func( ...@@ -474,7 +475,8 @@ rw_lock_sx_unlock_func(
holder. */ holder. */
if (my_atomic_load32_explicit(&lock->waiters, if (my_atomic_load32_explicit(&lock->waiters,
MY_MEMORY_ORDER_RELAXED)) { 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); os_event_set(lock->event);
sync_array_object_signalled(); sync_array_object_signalled();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment