From edee7b4b134c73d29b35699014d5edf7c5bb74a6 Mon Sep 17 00:00:00 2001 From: Evan Ramos Date: Tue, 24 Jul 2018 12:10:07 -0500 Subject: [PATCH] Add --with-mempool-cutoff=N to build and configure scripts Change-Id: I6092aa11d6b72c2e26d940de0da98ad6c1630acc --- src/arch/util/mempool.c | 3 ++- src/arch/util/mempool.h | 2 +- src/scripts/configure.ac | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/arch/util/mempool.c b/src/arch/util/mempool.c index 81618613b1..f8c80df311 100644 --- a/src/arch/util/mempool.c +++ b/src/arch/util/mempool.c @@ -32,7 +32,8 @@ Heavily modified by Nikhil Jain 11/28/2011 #include "mempool.h" int cutOffPoints[] = {64,128,256,512,1024,2048,4096,8192,16384,32768, 65536,131072,262144,524288,1048576,2097152,4194304, - 8388608,16777216,33554432,67108864}; + 8388608,16777216,33554432,67108864,134217728, + 268435456,536870912,1073741824}; INLINE_KEYWORD int which_pow2(size_t size) { diff --git a/src/arch/util/mempool.h b/src/arch/util/mempool.h index fea58921a5..02fe96cd1e 100644 --- a/src/arch/util/mempool.h +++ b/src/arch/util/mempool.h @@ -18,7 +18,7 @@ typedef CmiInt8 mem_handle_t; typedef void * (* mempool_newblockfn)(size_t *size, mem_handle_t *mem_hndl, int expand_flag); typedef void (* mempool_freeblock)(void *ptr, mem_handle_t mem_hndl); -#define cutOffNum 20 +#define cutOffNum CMK_MEMPOOL_CUTOFFNUM //given x as mptr get #define MEMPOOL_GetBlockHead(x) (&((x)->block_head)) diff --git a/src/scripts/configure.ac b/src/scripts/configure.ac index 96fc3221fd..8d204ff7a2 100644 --- a/src/scripts/configure.ac +++ b/src/scripts/configure.ac @@ -906,6 +906,20 @@ else fi fi +AC_ARG_WITH([mempool-cutoff], + [AS_HELP_STRING([--with-mempool-cutoff=N], + [exponent of the maximum power of two to use for bin sizes in the mempool])], + [], [with_mempool_cutoff=26]) + +if test "$((6 < $with_mempool_cutoff && $with_mempool_cutoff < 32))" = '1' +then + Echo "Using mempool cutoff... 2^$with_mempool_cutoff" + AC_DEFINE_UNQUOTED(CMK_MEMPOOL_CUTOFFNUM, $((with_mempool_cutoff - 6)), [mempool cutoff]) +else + Echo "Invalid number ($with_mempool_cutoff) specified for mempool cutoff. Valid range: 7 <= N <= 31" + test_finish 1 +fi + #### Check if compiler if 64 bit #### cat > $t < -- 2.11.4.GIT