Move link out of object space.

The link object was previously stored in a disused object.  This is
good for reducing meta-data, but if we want to reduce the meta-data
corruption potential, then this is not a good design choice.

This commit moves it into the Metaslab.
This commit is contained in:
Matthew Parkinson
2021-03-12 21:11:43 +00:00
committed by Matthew Parkinson
parent e7dce55f19
commit 59edf294d0
5 changed files with 75 additions and 107 deletions

View File

@@ -1074,18 +1074,14 @@ namespace snmalloc
size_t rsize = sizeclass_to_size(sizeclass);
auto& sl = small_classes[sizeclass];
Slab* slab;
if (likely(!sl.is_empty()))
{
stats().alloc_request(size);
stats().sizeclass_alloc(sizeclass);
SlabLink* link = sl.get_next();
slab = get_slab(link);
auto meta = reinterpret_cast<Metaslab*>(sl.get_next());
auto& ffl = small_fast_free_lists[sizeclass];
return slab->alloc<zero_mem, typename MemoryProvider::Pal>(
sl, ffl, rsize);
return meta->alloc<zero_mem, typename MemoryProvider::Pal>(ffl, rsize);
}
return small_alloc_rare<zero_mem, allow_reserve>(sizeclass, size);
}