aboutsummaryrefslogtreecommitdiff
path: root/src/core/file_sys/control_metadata.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-09-18 22:37:06 -0400
committerLioncash <mathew1800@gmail.com>2018-09-18 23:35:57 -0400
commitb834638dc06313f55cb1d74cac8f6680d135ccd3 (patch)
tree9993a4e398a6b0d8edf23d0683109cf5f29bea4e /src/core/file_sys/control_metadata.cpp
parentb6a4e19e0610c86b9612db84f18b043c242a558b (diff)
ring_buffer: Use std::hardware_destructive_interference_size to determine alignment size for avoiding false sharing
MSVC 19.11 (A.K.A. VS 15.3)'s C++ standard library implements P0154R1 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0154r1.html) which defines two new constants within the <new> header, std::hardware_destructive_interference_size and std::hardware_constructive_interference_size. std::hardware_destructive_interference_size defines the minimum recommended offset between two concurrently-accessed objects to avoid performance degradation due to contention introduced by the implementation (with the lower-bound being at least alignof(max_align_t)). In other words, the minimum offset between objects necessary to avoid false-sharing. std::hardware_constructive_interference_size on the other hand defines the maximum recommended size of contiguous memory occupied by two objects accessed wth temporal locality by concurrent threads (also defined to be at least alignof(max_align_t)). In other words the maximum size to promote true-sharing. So we can simply use this facility to determine the ideal alignment size. Unfortunately, only MSVC supports this right now, so we need to enclose it within an ifdef for the time being.
Diffstat (limited to 'src/core/file_sys/control_metadata.cpp')
0 files changed, 0 insertions, 0 deletions