From 7f6378f5bfb04e2e5be8387057072216dcde5cd6 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Mon, 18 Oct 2021 21:22:42 +0100 Subject: [PATCH] test/func/domestication: tweak for robustness - Grab a larger second allocation on the first allocator to dodge the sizeclass of the prior alloc on that allocator *and* any implicit, bootstrapping slabs that get opened (e.g., for remote queue message stubs). - De-FAST_PATH the domestication function. No need to always inline it, here. - Document things a little better --- src/test/func/domestication/domestication.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/func/domestication/domestication.cc b/src/test/func/domestication/domestication.cc index 26bc096..a1607de 100644 --- a/src/test/func/domestication/domestication.cc +++ b/src/test/func/domestication/domestication.cc @@ -69,7 +69,7 @@ namespace snmalloc /* Verify that a pointer points into the region managed by this config */ template - static SNMALLOC_FAST_PATH CapPtr< + static CapPtr< T, typename B::template with_wildness> capptr_domesticate(typename Backend::LocalState*, CapPtr p) @@ -119,6 +119,8 @@ int main() auto alloc1 = new Alloc(); + // Allocate from alloc1; the size doesn't matter a whole lot, it just needs to + // be a small object and so definitely owned by this allocator rather. auto p = alloc1->alloc(48); std::cout << "Allocated p " << p << std::endl; @@ -137,7 +139,9 @@ int main() snmalloc::CustomGlobals::domesticate_trace = true; snmalloc::CustomGlobals::domesticate_count = 0; - auto q = alloc1->alloc(56); + // Open a new slab, so that slow path will pick up the message queue. That + // means this should be a sizeclass we've not used before, even internally. + auto q = alloc1->alloc(512); std::cout << "Allocated q " << q << std::endl; snmalloc::CustomGlobals::domesticate_trace = false;