From 94ab856ff5378c6b600c1304cb326ce3f1651df8 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Wed, 15 Sep 2021 00:05:16 +0100 Subject: [PATCH] NFC: remote queue domestication plumbing These are, at present, just identity functions in the right places. --- src/mem/corealloc.h | 4 +++- src/mem/remoteallocator.h | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mem/corealloc.h b/src/mem/corealloc.h index c882912..77363f6 100644 --- a/src/mem/corealloc.h +++ b/src/mem/corealloc.h @@ -421,13 +421,15 @@ namespace snmalloc handle_message_queue_inner(Action action, Args... args) { bool need_post = false; + auto domesticate = [](FreeObject::QueuePtr p) + SNMALLOC_FAST_PATH_LAMBDA { return p; }; for (size_t i = 0; i < REMOTE_BATCH; i++) { auto p = message_queue().peek(); auto& entry = SharedStateHandle::Pagemap::get_metaentry( backend_state_ptr(), snmalloc::address_cast(p)); - auto r = message_queue().dequeue(key_global); + auto r = message_queue().dequeue(key_global, domesticate); if (unlikely(!r.second)) break; diff --git a/src/mem/remoteallocator.h b/src/mem/remoteallocator.h index 4b5ff1b..bce6352 100644 --- a/src/mem/remoteallocator.h +++ b/src/mem/remoteallocator.h @@ -102,13 +102,12 @@ namespace snmalloc /** * Returns the front message, or null if not possible to return a message. */ + template std::pair< FreeObject::HeadPtr, bool> - dequeue(const FreeListKey& key) + dequeue(const FreeListKey& key, Domesticator domesticate) { - auto domesticate = [](FreeObject::QueuePtr p) - SNMALLOC_FAST_PATH_LAMBDA { return p; }; invariant(); FreeObject::HeadPtr first = domesticate(front);