diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2016-09-14 15:56:06 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2016-10-17 18:35:49 +0400 |
commit | 5608a737ea7b5630452957b82deff4c76406041e (patch) | |
tree | c62d02827644754c05406260a95face811c4ce5d /storage/innobase/include/sync0rw.ic | |
parent | f4d885c4e9d929639b7075b7382b439f0b4e3cc1 (diff) | |
download | mariadb-git-5608a737ea7b5630452957b82deff4c76406041e.tar.gz |
MDEV-10813 - Clean-up InnoDB atomics, memory barriers and mutexes
No point to issue RELEASE memory barrier in os_thread_create_func(): thread
creation is full memory barrier.
No point to issue os_wmb in rw_lock_set_waiter_flag() and
rw_lock_reset_waiter_flag(): this is deadcode and it is unlikely operational
anyway. If atomic builtins are unavailable - memory barriers are most certainly
unavailable too.
RELEASE memory barrier is definitely abused in buf_pool_withdraw_blocks(): most
probably it was supposed to commit volatile variable update, which is not what
memory barriers actually do. To operate properly it needs corresponding ACQUIRE
barrier without an associated atomic operation anyway.
ACQUIRE memory barrier is definitely abused in log_write_up_to(): most probably
it was supposed to synchronize dirty read of log_sys->write_lsn. To operate
properly it needs corresponding RELEASE barrier without an associated atomic
operation anyway.
Removed a bunch of ACQUIRE memory barriers from InnoDB rwlocks. They're
meaningless without corresponding RELEASE memory barriers.
Valid usage example of memory barriers without an associated atomic operation:
http://en.cppreference.com/w/cpp/atomic/atomic_thread_fence
Diffstat (limited to 'storage/innobase/include/sync0rw.ic')
-rw-r--r-- | storage/innobase/include/sync0rw.ic | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic index fc7d80ac9da..4d3e8acd3e6 100644 --- a/storage/innobase/include/sync0rw.ic +++ b/storage/innobase/include/sync0rw.ic @@ -92,7 +92,6 @@ rw_lock_set_waiter_flag( my_atomic_storelint(&lock->waiters, 1); #else /* INNODB_RW_LOCKS_USE_ATOMICS */ lock->waiters = 1; - os_wmb; #endif /* INNODB_RW_LOCKS_USE_ATOMICS */ } @@ -110,7 +109,6 @@ rw_lock_reset_waiter_flag( my_atomic_storelint(&lock->waiters, 0); #else /* INNODB_RW_LOCKS_USE_ATOMICS */ lock->waiters = 0; - os_wmb; #endif /* INNODB_RW_LOCKS_USE_ATOMICS */ } @@ -272,7 +270,6 @@ rw_lock_lock_word_decr( #ifdef INNODB_RW_LOCKS_USE_ATOMICS lint local_lock_word; - os_rmb; local_lock_word = lock->lock_word; while (local_lock_word > threshold) { if (my_atomic_caslint(&lock->lock_word, |