1
1

Use free list for registrations, otherwise we may OBJ_RELEASE in the memory

callbacks. 

This commit was SVN r8884.
Этот коммит содержится в:
Galen Shipman 2006-02-02 17:14:49 +00:00
родитель abc67a257f
Коммит a0d3ddd267
3 изменённых файлов: 19 добавлений и 5 удалений

Просмотреть файл

@ -55,6 +55,7 @@ typedef struct mca_mpool_base_resources_t mca_mpool_base_resources_t;
struct mca_mpool_mvapi_module_t { struct mca_mpool_mvapi_module_t {
mca_mpool_base_module_t super; mca_mpool_base_module_t super;
struct mca_mpool_base_resources_t hca_pd; 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; }; 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. * Initializes the mpool module.
*/ */

Просмотреть файл

@ -51,6 +51,11 @@ void mca_mpool_mvapi_module_init(mca_mpool_mvapi_module_t* mpool)
mpool->super.rcache = mpool->super.rcache =
mca_rcache_base_module_create(mca_mpool_mvapi_component.rcache_name); mca_rcache_base_module_create(mca_mpool_mvapi_component.rcache_name);
mpool->super.flags = MCA_MPOOL_FLAGS_MPI_ALLOC_MEM; 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; mca_mpool_mvapi_registration_t * vapi_reg;
VAPI_mrw_t mr_in, mr_out; VAPI_mrw_t mr_in, mr_out;
VAPI_ret_t ret; VAPI_ret_t ret;
opal_list_item_t *item;
int rc;
assert(size > 0); assert(size > 0);
memset(&mr_in, 0, sizeof(VAPI_mrw_t)); memset(&mr_in, 0, sizeof(VAPI_mrw_t));
memset(&mr_out, 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.mpool = mpool;
vapi_reg->base_reg.flags = flags; vapi_reg->base_reg.flags = flags;
vapi_reg->hndl = VAPI_INVAL_HNDL; vapi_reg->hndl = VAPI_INVAL_HNDL;
@ -129,7 +140,7 @@ int mca_mpool_mvapi_register(
if(VAPI_OK != ret){ if(VAPI_OK != ret){
opal_output(0, "error registering memory of size %d: %s ", size, VAPI_strerror(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; return OMPI_ERROR;
} }
@ -226,7 +237,7 @@ int mca_mpool_mvapi_release(
opal_output(0, "%s: error unpinning vapi memory\n", __func__); opal_output(0, "%s: error unpinning vapi memory\n", __func__);
return OMPI_ERROR; return OMPI_ERROR;
} }
OBJ_RELEASE(vapi_reg); OMPI_FREE_LIST_RETURN(&mpool_mvapi->reg_list, (opal_list_item_t*) vapi_reg);
} }
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }

Просмотреть файл

@ -111,8 +111,9 @@ int mca_rcache_rb_tree_insert(
mca_rcache_rb_tree_item_t* rb_tree_item; mca_rcache_rb_tree_item_t* rb_tree_item;
OMPI_FREE_LIST_GET(&rb_module->rb_tree_item_list, item, rc); OMPI_FREE_LIST_GET(&rb_module->rb_tree_item_list, item, rc);
if(rc != OMPI_SUCCESS) if(OMPI_SUCCESS != rc) {
return rc; return rc;
}
rb_tree_item = (mca_rcache_rb_tree_item_t*) item; rb_tree_item = (mca_rcache_rb_tree_item_t*) item;
rb_tree_item->key.base = reg->base; rb_tree_item->key.base = reg->base;