diff --git a/ompi/mca/mpool/mvapi/mpool_mvapi.h b/ompi/mca/mpool/mvapi/mpool_mvapi.h index 10597efe58..7369104d3d 100644 --- a/ompi/mca/mpool/mvapi/mpool_mvapi.h +++ b/ompi/mca/mpool/mvapi/mpool_mvapi.h @@ -55,6 +55,7 @@ typedef struct mca_mpool_base_resources_t mca_mpool_base_resources_t; struct mca_mpool_mvapi_module_t { mca_mpool_base_module_t super; struct mca_mpool_base_resources_t hca_pd; + ompi_free_list_t reg_list; }; typedef struct mca_mpool_mvapi_module_t mca_mpool_mvapi_module_t; @@ -78,6 +79,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_mpool_mvapi_registration_t); + /* * Initializes the mpool module. */ diff --git a/ompi/mca/mpool/mvapi/mpool_mvapi_module.c b/ompi/mca/mpool/mvapi/mpool_mvapi_module.c index aeb72e7012..7dc5721e3d 100644 --- a/ompi/mca/mpool/mvapi/mpool_mvapi_module.c +++ b/ompi/mca/mpool/mvapi/mpool_mvapi_module.c @@ -51,6 +51,11 @@ void mca_mpool_mvapi_module_init(mca_mpool_mvapi_module_t* mpool) mpool->super.rcache = mca_rcache_base_module_create(mca_mpool_mvapi_component.rcache_name); mpool->super.flags = MCA_MPOOL_FLAGS_MPI_ALLOC_MEM; + + OBJ_CONSTRUCT(&mpool->reg_list, ompi_free_list_t); + ompi_free_list_init(&mpool->reg_list, sizeof(mca_mpool_mvapi_registration_t), + OBJ_CLASS(mca_mpool_mvapi_registration_t), 0, -1, 32, NULL); + } @@ -91,14 +96,20 @@ int mca_mpool_mvapi_register( mca_mpool_mvapi_registration_t * vapi_reg; VAPI_mrw_t mr_in, mr_out; VAPI_ret_t ret; - + opal_list_item_t *item; + int rc; assert(size > 0); memset(&mr_in, 0, sizeof(VAPI_mrw_t)); memset(&mr_out, 0, sizeof(VAPI_mrw_t)); - vapi_reg = OBJ_NEW(mca_mpool_mvapi_registration_t); + OMPI_FREE_LIST_GET(&mpool_module->reg_list, item, rc); + if(OMPI_SUCCESS != rc) { + return rc; + } + vapi_reg = (mca_mpool_mvapi_registration_t*) item; + vapi_reg->base_reg.mpool = mpool; vapi_reg->base_reg.flags = flags; vapi_reg->hndl = VAPI_INVAL_HNDL; @@ -129,7 +140,7 @@ int mca_mpool_mvapi_register( if(VAPI_OK != ret){ opal_output(0, "error registering memory of size %d: %s ", size, VAPI_strerror(ret)); - OBJ_RELEASE(vapi_reg); + OMPI_FREE_LIST_RETURN(&mpool_module->reg_list, item); return OMPI_ERROR; } @@ -226,7 +237,7 @@ int mca_mpool_mvapi_release( opal_output(0, "%s: error unpinning vapi memory\n", __func__); return OMPI_ERROR; } - OBJ_RELEASE(vapi_reg); + OMPI_FREE_LIST_RETURN(&mpool_mvapi->reg_list, (opal_list_item_t*) vapi_reg); } return OMPI_SUCCESS; } diff --git a/ompi/mca/rcache/rb/rcache_rb_tree.c b/ompi/mca/rcache/rb/rcache_rb_tree.c index d117b3b996..e8a20f7c27 100644 --- a/ompi/mca/rcache/rb/rcache_rb_tree.c +++ b/ompi/mca/rcache/rb/rcache_rb_tree.c @@ -111,8 +111,9 @@ int mca_rcache_rb_tree_insert( mca_rcache_rb_tree_item_t* rb_tree_item; OMPI_FREE_LIST_GET(&rb_module->rb_tree_item_list, item, rc); - if(rc != OMPI_SUCCESS) + if(OMPI_SUCCESS != rc) { return rc; + } rb_tree_item = (mca_rcache_rb_tree_item_t*) item; rb_tree_item->key.base = reg->base;