summaryrefslogtreecommitdiff
path: root/include/my_atomic_wrapper.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.5 into 10.6Marko Mäkelä2023-02-101-1/+1
|\
| * Merge 10.4 into 10.5Marko Mäkelä2023-02-101-1/+1
| |\
| | * Apply clang-tidy to remove empty constructors / destructorsVicențiu Ciorbaru2023-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is the result of running run-clang-tidy -fix -header-filter=.* -checks='-*,modernize-use-equals-default' . Code style changes have been done on top. The result of this change leads to the following improvements: 1. Binary size reduction. * For a -DBUILD_CONFIG=mysql_release build, the binary size is reduced by ~400kb. * A raw -DCMAKE_BUILD_TYPE=Release reduces the binary size by ~1.4kb. 2. Compiler can better understand the intent of the code, thus it leads to more optimization possibilities. Additionally it enabled detecting unused variables that had an empty default constructor but not marked so explicitly. Particular change required following this patch in sql/opt_range.cc result_keys, an unused template class Bitmap now correctly issues unused variable warnings. Setting Bitmap template class constructor to default allows the compiler to identify that there are no side-effects when instantiating the class. Previously the compiler could not issue the warning as it assumed Bitmap class (being a template) would not be performing a NO-OP for its default constructor. This prevented the "unused variable warning".
* | | Merge 10.5 into 10.6Marko Mäkelä2021-06-261-2/+3
|\ \ \ | |/ /
| * | MDEV-26010 fixup: Use acquire/release memory orderMarko Mäkelä2021-06-261-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 5f22511e35674ecc376f4c56217ee2d78f92c772 we depend on Total Store Ordering. For correct operation on ISAs that implement weaker memory ordering, we must explicitly use release/acquire stores and loads on buf_page_t::oldest_modification_ to prevent a race condition when buf_page_t::list does not happen to be on the same cache line. buf_page_t::clear_oldest_modification(): Assert that the block is not in buf_pool.flush_list, and use std::memory_order_release. buf_page_t::oldest_modification_acquire(): Read oldest_modification_ with std::memory_order_acquire. In this way, if the return value is 0, the caller may safely assume that it will not observe the buf_page_t as being in buf_pool.flush_list, even if it is not holding buf_pool.flush_list_mutex. buf_flush_relocate_on_flush_list(), buf_LRU_free_page(): Invoke buf_page_t::oldest_modification_acquire().
* | | Merge 10.5 into 10.6 (except MDEV-24630)Marko Mäkelä2021-03-301-2/+4
|\ \ \ | |/ / | | | | | | | | | | | | Commit 76d2846a71a155ee2861fd52e6635e35490a9dd1 was for 10.5 only. It caused some performance regression on 10.6 in some cases, likely related to the removal of ib_mutex_t in MDEV-21452.
| * | MDEV-24302 follow-up: RESET MASTER hangsbb-10.5-MDEV-24302Marko Mäkelä2021-03-301-2/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As pointed out by Andrei Elkin, the previous fix did not fix one race condition that may have caused the observed hang. innodb_log_flush_request(): If we are enqueueing the very first request at the same time the log write is being completed, we must ensure that a near-concurrent call to log_flush_notify() will not result in a missed notification. We guarantee this by release-acquire operations on log_requests.start and log_sys.flushed_to_disk_lsn. log_flush_notify_and_unlock(): Cleanup: Always release the mutex. log_sys_t::get_flushed_lsn(): Use acquire memory order. log_sys_t::set_flushed_lsn(): Use release memory order. log_sys_t::set_lsn(): Use release memory order. log_sys_t::get_lsn(): Use relaxed memory order by default, and allow the caller to specify acquire memory order explicitly. Whenever the log_sys.mutex is being held or when log writes are prohibited during startup, we can use a relaxed load. Likewise, in some assertions where reading a stale value of log_sys.lsn should not matter, we can use a relaxed load. This will cause some additional instructions to be emitted on architectures that do not implement Total Store Ordering (TSO), such as POWER, ARM, and RISC-V Weak Memory Ordering (RVWMO).
* | MDEV-25281: Switch to use non-atomic (vs atomic) distributed counter toKrunal Bauskar2021-03-291-0/+1
|/ | | | | | | | | | | | | | | | track page-access counter As part of MDEV-21212, n_page_gets that is meant to track page access, is ported to use distributed counter that default uses atomic sub-counters. n_page_gets originally was a non-atomic counter that represented an approximate value of pages tracked. Using the said analogy it doesn't need to be an atomic distributed counter. This patch introduces an interface that allows distributed counter to be used with atomic and non-atomic sub-counter (through template) and also port n_page_gets to use non-atomic distributed counter using the said updated interface.
* MDEV-24334 make monitor_set_tbl global variable thread-safeEugene Kosov2020-12-031-0/+5
| | | | | | | | | | | Atomic_relaxed<T>: add fetch_or() and fetch_and() innodb_init(): rely on a zero-initialization of a global variable monitor_set_tbl: make Atomic_relaxed<ulint> array and use proper operations for setting bit, unsetting bit and reading bit Reviewed by: Marko Mäkelä
* Merge 10.3 into 10.4Marko Mäkelä2020-09-031-0/+2
|
* Move c++ code from my_atomic.h to my_atomic_wrapper.hMonty2020-05-191-0/+58
This is because it breaks code that is using extern "C" when including my_atomic, which is the case with ha_s3.cc