Small changes (#159)
* Use NoZero for fresh pages * MADV_DONTNEED only use for greater than a whole slab * Simplify free list threading code
This commit is contained in:
committed by
GitHub
parent
d900e29424
commit
06eef5c4c5
@@ -37,11 +37,15 @@ namespace snmalloc
|
||||
template<bool page_aligned = false>
|
||||
void zero(void* p, size_t size) noexcept
|
||||
{
|
||||
// QEMU does not seem to be giving the desired behaviour for MADV_DONTNEED.
|
||||
// switch back to memset only for QEMU.
|
||||
// QEMU does not seem to be giving the desired behaviour for
|
||||
// MADV_DONTNEED. switch back to memset only for QEMU.
|
||||
# ifndef SNMALLOC_QEMU_WORKAROUND
|
||||
if (page_aligned || is_aligned_block<OS_PAGE_SIZE>(p, size))
|
||||
if (
|
||||
(page_aligned || is_aligned_block<OS_PAGE_SIZE>(p, size)) &&
|
||||
(size > SLAB_SIZE))
|
||||
{
|
||||
// Only use this on large allocations as memset faster, and doesn't
|
||||
// introduce IPI so faster for small allocations.
|
||||
SNMALLOC_ASSERT(is_aligned_block<OS_PAGE_SIZE>(p, size));
|
||||
madvise(p, size, MADV_DONTNEED);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user