Skip to content

Commit

Permalink
NFC: plumb entropy from LocalAlloc to BatchIt
Browse files Browse the repository at this point in the history
  • Loading branch information
nwf-msr authored and nwf committed Sep 22, 2024
1 parent 54052bb commit c3c0c4f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/snmalloc/mem/localalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ namespace snmalloc
address_cast(entry.get_slab_metadata()));
#endif
local_cache.remote_dealloc_cache.template dealloc<sizeof(CoreAlloc)>(
entry.get_slab_metadata(), p);
entry.get_slab_metadata(), p, &local_cache.entropy);
post_remote_cache();
return;
}
Expand Down Expand Up @@ -679,7 +679,7 @@ namespace snmalloc
if (local_cache.remote_dealloc_cache.reserve_space(entry))
{
local_cache.remote_dealloc_cache.template dealloc<sizeof(CoreAlloc)>(
entry.get_slab_metadata(), p_tame);
entry.get_slab_metadata(), p_tame, &local_cache.entropy);
# ifdef SNMALLOC_TRACING
message<1024>(
"Remote dealloc fast {} ({}, {})",
Expand Down
11 changes: 10 additions & 1 deletion src/snmalloc/mem/remotecache.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ namespace snmalloc
SNMALLOC_FAST_PATH void dealloc(
typename Config::PagemapEntry::SlabMetadata* meta,
freelist::HeadPtr r,
LocalEntropy* entropy,
Forward forward)
{
UNUSED(entropy);

size_t ix_set = ring_set(meta);

for (size_t ix_way = 0; ix_way < DEALLOC_BATCH_RING_ASSOC; ix_way++)
Expand Down Expand Up @@ -152,8 +155,11 @@ namespace snmalloc
SNMALLOC_FAST_PATH void dealloc(
typename Config::PagemapEntry::SlabMetadata*,
freelist::HeadPtr r,
LocalEntropy* entropy,
Forward forward)
{
UNUSED(entropy);

auto& entry = Config::Backend::get_metaentry(address_cast(r));
forward(
entry.get_remote()->trunc_id(),
Expand Down Expand Up @@ -237,7 +243,9 @@ namespace snmalloc

template<size_t allocator_size>
SNMALLOC_FAST_PATH void dealloc(
typename Config::PagemapEntry::SlabMetadata* meta, capptr::Alloc<void> p)
typename Config::PagemapEntry::SlabMetadata* meta,
capptr::Alloc<void> p,
LocalEntropy* entropy)
{
SNMALLOC_ASSERT(initialised);

Expand All @@ -246,6 +254,7 @@ namespace snmalloc
batching.dealloc(
meta,
r,
entropy,
[this](
RemoteAllocator::alloc_id_t target_id,
capptr::Alloc<RemoteMessage> msg) {
Expand Down

0 comments on commit c3c0c4f

Please sign in to comment.