Add prefetch to mpscq.

This commit is contained in:
Matthew Parkinson
2019-07-02 14:06:24 +01:00
parent daebe3f5e5
commit fdcbcf7016
2 changed files with 10 additions and 0 deletions

View File

@@ -136,6 +136,15 @@ namespace snmalloc
#endif
}
inline void prefetch(void* ptr)
{
#if defined(PLATFORM_IS_X86)
_mm_prefetch(reinterpret_cast<const char *>(ptr), _MM_HINT_T0);
#else
# warning "Missing pause intrinsic"
#endif
}
inline uint64_t tick()
{
#if defined(PLATFORM_IS_X86)

View File

@@ -71,6 +71,7 @@ namespace snmalloc
if (next != nullptr)
{
front = next;
bits::prefetch(&(next->next));
assert(front);
std::atomic_thread_fence(std::memory_order_acquire);
invariant();