summaryrefslogtreecommitdiff
path: root/lib/block_allocator.cpp
diff options
context:
space:
mode:
authorJosh Blum2013-01-31 12:39:09 -0800
committerJosh Blum2013-01-31 12:39:09 -0800
commit28a1850a27179952293c64b0c67e8ed56fb76f84 (patch)
tree91c3976b5b085bd205e68983322a2bda2e6db443 /lib/block_allocator.cpp
parent8242e504d5113a54010eb5863c01b0e0f4cedd74 (diff)
downloadsandhi-28a1850a27179952293c64b0c67e8ed56fb76f84.tar.gz
sandhi-28a1850a27179952293c64b0c67e8ed56fb76f84.tar.bz2
sandhi-28a1850a27179952293c64b0c67e8ed56fb76f84.zip
gras: misc tweaks to alloc sizes
Diffstat (limited to 'lib/block_allocator.cpp')
-rw-r--r--lib/block_allocator.cpp8
1 files changed, 5 insertions, 3 deletions
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]
);