diff options
author | Michael Widenius <monty@mariadb.org> | 2014-08-19 21:35:14 +0300 |
---|---|---|
committer | Michael Widenius <monty@mariadb.org> | 2014-08-19 21:35:14 +0300 |
commit | bd2117d154b9cc367b708932de5d6064a339462d (patch) | |
tree | 6c0fac6d84a3f88acb40ca9e410bd7724440af86 /storage/xtradb/sync | |
parent | cfa1ce81bb7992c362958bb95f41325ce2109834 (diff) | |
parent | 5569132ffebba3fd2e37964543f658ed24d8caaf (diff) | |
download | mariadb-git-bd2117d154b9cc367b708932de5d6064a339462d.tar.gz |
Automatic merge from 5.5
Fixed 2 failing tests by replacing result files
Diffstat (limited to 'storage/xtradb/sync')
-rw-r--r-- | storage/xtradb/sync/sync0arr.cc | 3 | ||||
-rw-r--r-- | storage/xtradb/sync/sync0rw.cc | 20 | ||||
-rw-r--r-- | storage/xtradb/sync/sync0sync.cc | 7 |
3 files changed, 27 insertions, 3 deletions
diff --git a/storage/xtradb/sync/sync0arr.cc b/storage/xtradb/sync/sync0arr.cc index 95ecf496e82..6e30ccf07df 100644 --- a/storage/xtradb/sync/sync0arr.cc +++ b/storage/xtradb/sync/sync0arr.cc @@ -849,6 +849,7 @@ sync_arr_cell_can_wake_up( lock = static_cast<rw_lock_t*>(cell->wait_object); + os_rmb; if (lock->lock_word > 0) { /* Either unlocked or only read locked. */ @@ -860,6 +861,7 @@ sync_arr_cell_can_wake_up( lock = static_cast<rw_lock_t*>(cell->wait_object); /* lock_word == 0 means all readers have left */ + os_rmb; if (lock->lock_word == 0) { return(TRUE); @@ -869,6 +871,7 @@ sync_arr_cell_can_wake_up( lock = static_cast<rw_lock_t*>(cell->wait_object); /* lock_word > 0 means no writer or reserved writer */ + os_rmb; if (lock->lock_word > 0) { return(TRUE); diff --git a/storage/xtradb/sync/sync0rw.cc b/storage/xtradb/sync/sync0rw.cc index 79741e3cdce..d5a069b96d3 100644 --- a/storage/xtradb/sync/sync0rw.cc +++ b/storage/xtradb/sync/sync0rw.cc @@ -41,6 +41,7 @@ Created 9/11/1995 Heikki Tuuri #include "srv0srv.h" #include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */ #include "ha_prototypes.h" +#include "my_cpu.h" /* IMPLEMENTATION OF THE RW_LOCK @@ -448,6 +449,8 @@ lock_loop: lock)) { /* Spin waiting for the writer field to become free */ + os_rmb; + HMT_low(); while (i < SYNC_SPIN_ROUNDS && lock->lock_word <= 0) { if (srv_spin_wait_delay) { ut_delay(ut_rnd_interval(0, @@ -455,9 +458,11 @@ lock_loop: } i++; + os_rmb; } - if (i == SYNC_SPIN_ROUNDS) { + HMT_medium(); + if (lock->lock_word <= 0) { os_thread_yield(); } @@ -605,14 +610,18 @@ rw_lock_x_lock_wait( ut_ad(lock->lock_word <= 0); + os_rmb; + HMT_low(); while (lock->lock_word < 0) { if (srv_spin_wait_delay) { ut_delay(ut_rnd_interval(0, srv_spin_wait_delay)); } if(i < SYNC_SPIN_ROUNDS) { i++; + os_rmb; continue; } + HMT_medium(); /* If there is still a reader, then go to sleep.*/ rw_lock_stats.rw_x_spin_round_count.add(counter_index, i); @@ -660,7 +669,9 @@ rw_lock_x_lock_wait( prio_rw_lock->high_priority_wait_ex_waiter = 0; } } + HMT_low(); } + HMT_medium(); rw_lock_stats.rw_x_spin_round_count.add(counter_index, i); } @@ -701,7 +712,8 @@ rw_lock_x_lock_low( } else { os_thread_id_t thread_id = os_thread_get_curr_id(); - + if (!pass) + os_rmb; /* Decrement failed: relock or failed lock */ if (!pass && lock->recursive && os_thread_eq(lock->writer_thread, thread_id)) { @@ -792,6 +804,8 @@ lock_loop: } /* Spin waiting for the lock_word to become free */ + os_rmb; + HMT_low(); while (i < SYNC_SPIN_ROUNDS && lock->lock_word <= 0) { if (srv_spin_wait_delay) { @@ -800,7 +814,9 @@ lock_loop: } i++; + os_rmb; } + HMT_medium(); if (i == SYNC_SPIN_ROUNDS) { os_thread_yield(); } else { diff --git a/storage/xtradb/sync/sync0sync.cc b/storage/xtradb/sync/sync0sync.cc index e078f223efc..661cdb4395e 100644 --- a/storage/xtradb/sync/sync0sync.cc +++ b/storage/xtradb/sync/sync0sync.cc @@ -46,6 +46,7 @@ Created 9/5/1995 Heikki Tuuri # include "srv0start.h" /* srv_is_being_started */ #endif /* UNIV_SYNC_DEBUG */ #include "ha_prototypes.h" +#include "my_cpu.h" /* REASONS FOR IMPLEMENTING THE SPIN LOCK MUTEX @@ -535,6 +536,8 @@ mutex_set_waiters( ptr = &(mutex->waiters); + os_wmb; + *ptr = n; /* Here we assume that the write of a single word in memory is atomic */ } @@ -587,13 +590,15 @@ mutex_loop: spin_loop: + HMT_low(); while (mutex_get_lock_word(mutex) != 0 && i < SYNC_SPIN_ROUNDS) { if (srv_spin_wait_delay) { ut_delay(ut_rnd_interval(0, srv_spin_wait_delay)); } - + os_rmb; // Ensure future reads sees new values i++; } + HMT_medium(); if (i == SYNC_SPIN_ROUNDS) { os_thread_yield(); |