зеркало из https://github.com/microsoft/snmalloc.git
Improved fast path for pagemap.
This commit is contained in:
Родитель
7f7704b6fc
Коммит
b0c1531221
|
@ -112,9 +112,30 @@ namespace snmalloc
|
|||
// to see that correctly.
|
||||
PagemapEntry* value = e->load(std::memory_order_relaxed);
|
||||
|
||||
if ((value == nullptr) || (value == LOCKED_ENTRY))
|
||||
if (likely((value != nullptr) && (value != LOCKED_ENTRY)))
|
||||
{
|
||||
result = true;
|
||||
return value;
|
||||
}
|
||||
if constexpr (create_addr)
|
||||
{
|
||||
return get_node_slow(e, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
NOINLINE PagemapEntry* get_node_slow(std::atomic<PagemapEntry*>* e, bool& result)
|
||||
{
|
||||
// The page map nodes are all allocated directly from the OS zero
|
||||
// initialised with a system call. We don't need any ordered to guarantee
|
||||
// to see that correctly.
|
||||
PagemapEntry* value = e->load(std::memory_order_relaxed);
|
||||
|
||||
if ((value == nullptr) || (value == LOCKED_ENTRY))
|
||||
{
|
||||
value = nullptr;
|
||||
|
||||
|
@ -135,12 +156,6 @@ namespace snmalloc
|
|||
value = e->load(std::memory_order_acquire);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
return value;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче