Add --with-mempool-cutoff=N to build and configure scripts 94/4394/9
authorEvan Ramos <evan@hpccharm.com>
Tue, 24 Jul 2018 17:10:07 +0000 (12:10 -0500)
committerEvan Ramos <evan@hpccharm.com>
Tue, 20 Nov 2018 01:57:56 +0000 (19:57 -0600)
Change-Id: I6092aa11d6b72c2e26d940de0da98ad6c1630acc

src/arch/util/mempool.c
src/arch/util/mempool.h
src/scripts/configure.ac

index 81618613b10ea7b36e2fc11e261117288d567bb1..f8c80df311a6e69af78e497c3d2ea917ef90ade0 100644 (file)
@@ -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)
 {
index fea58921a5dbc8f8b59eefd66b6ed3c46d1f2129..02fe96cd1e82f14ac3ff0314429bfe18f050bdd9 100644 (file)
@@ -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))
index 96fc3221fde661e6c106a1cc39eb5eba3d81e245..8d204ff7a2b6bd7deb8e88d329e393d00b649aa1 100644 (file)
@@ -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 <<EOT
 #include <stdio.h>