block_header adds a pointer to the very first block (i.e. the mempool ptr)
authorGengbin Zheng <gzheng@illinois.edu>
Wed, 15 Feb 2012 05:10:58 +0000 (21:10 -0800)
committerGengbin Zheng <gzheng@illinois.edu>
Wed, 15 Feb 2012 05:10:58 +0000 (21:10 -0800)
src/arch/util/mempool.c
src/arch/util/mempool.h

index e4cf852f9923f349d7ca7fa94d3b842b72949410..9ad1498d9fc1d1e96471a52af96901573ae167e7 100644 (file)
@@ -190,6 +190,7 @@ mempool_type *mempool_init(size_t pool_size, mempool_newblockfn allocfn, mempool
   mptr->mempoolLock = CmiCreateLock();
 #endif
   mptr->block_head.mempool_ptr = pool;
+  mptr->block_head.mptr = pool;
   mptr->block_head.mem_hndl = mem_hndl;
   mptr->block_head.size = pool_size;
   mptr->block_head.block_next = 0;
@@ -272,6 +273,7 @@ void*  mempool_malloc(mempool_type *mptr, int size, int expand)
       mptr->block_tail = tail->block_next;
 
       current->mempool_ptr = pool;
+      current->mptr = mptr;
       current->mem_hndl = mem_hndl;
       current->size = expand_size;
       current->block_next = 0;
index b1345add52eb5d1a2e1a8209d9b5abb6408bc7ac..5ad7f9ac0522d8a8d93718cd7656a2c2f932c09f 100644 (file)
@@ -63,6 +63,7 @@ typedef struct block_header_
     int                 msgs_in_recv;
 #endif
     void                *mempool_ptr;
+    void                *mptr;
 } block_header;
 
 // only at beginning of first block of mempool