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 committed Sep 12, 2024
1 parent a6605e3 commit 9d7df7e
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 @@ -61,8 +61,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 @@ -137,8 +140,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 @@ -222,7 +228,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 @@ -231,6 +239,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 9d7df7e

Please sign in to comment.