From 28a1850a27179952293c64b0c67e8ed56fb76f84 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 31 Jan 2013 12:39:09 -0800 Subject: gras: misc tweaks to alloc sizes --- include/gras/gras.hpp | 2 +- lib/block_allocator.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/gras/gras.hpp b/include/gras/gras.hpp index fefc35d..748e682 100644 --- a/include/gras/gras.hpp +++ b/include/gras/gras.hpp @@ -44,7 +44,7 @@ #define GRAS_EXTERN #endif // GRAS_DLL -#define GRAS_MAX_ALIGNMENT 32 +#define GRAS_MAX_ALIGNMENT 64 //define cross platform attribute macros #if defined(GRAS_DEBUG) diff --git a/lib/block_allocator.cpp b/lib/block_allocator.cpp index edac4c6..c1ef827 100644 --- a/lib/block_allocator.cpp +++ b/lib/block_allocator.cpp @@ -7,9 +7,9 @@ using namespace gras; -const size_t AT_LEAST_DEFAULT_ITEMS = 1 << 13; +const size_t AT_LEAST_BYTES = 1 << 14; const size_t AHH_TOO_MANY_BYTES = 1 << 20; //TODO -const size_t THIS_MANY_BUFFERS = 32; +const size_t THIS_MANY_BUFFERS = 16; void BlockActor::buffer_returner(const size_t index, SBuffer &buffer) { @@ -50,6 +50,8 @@ static size_t recommend_length( return Nmin_bytes; } +#define my_round_up_mult(num, mult) (((num)*(mult))+(mult)-1)/(mult) + void BlockActor::handle_top_alloc(const TopAllocMessage &, const Theron::Address from) { MESSAGE_TRACER(); @@ -60,7 +62,7 @@ void BlockActor::handle_top_alloc(const TopAllocMessage &, const Theron::Address { const size_t bytes = recommend_length( this->output_allocation_hints[i], - AT_LEAST_DEFAULT_ITEMS*this->output_items_sizes[i], + my_round_up_mult(AT_LEAST_BYTES, this->output_items_sizes[i]), this->output_configs[i].reserve_items*this->output_items_sizes[i], this->output_configs[i].maximum_items*this->output_items_sizes[i] ); -- cgit