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:
Matthew Parkinson
2020-04-02 07:04:03 +01:00
committed by GitHub
parent d900e29424
commit 06eef5c4c5
3 changed files with 24 additions and 38 deletions

View File

@@ -185,18 +185,19 @@ namespace snmalloc
void push_space(address_t start, size_t large_class)
{
// All fresh pages so can use "NoZero"
void* p = pointer_cast<void>(start);
if (large_class > 0)
PAL::template notify_using<YesZero>(p, OS_PAGE_SIZE);
PAL::template notify_using<NoZero>(p, OS_PAGE_SIZE);
else
{
if (decommit_strategy == DecommitSuperLazy)
{
PAL::template notify_using<YesZero>(p, OS_PAGE_SIZE);
PAL::template notify_using<NoZero>(p, OS_PAGE_SIZE);
p = new (p) Decommittedslab();
}
else
PAL::template notify_using<YesZero>(p, SUPERSLAB_SIZE);
PAL::template notify_using<NoZero>(p, SUPERSLAB_SIZE);
}
large_stack[large_class].push(reinterpret_cast<Largeslab*>(p));
}