1
1

Further work on moving checking if the user buffer is pinned to the pml

level. 

This commit was SVN r6125.
Этот коммит содержится в:
Galen Shipman 2005-06-21 21:20:23 +00:00
родитель d334f6d4bc
Коммит aac0dadddb
14 изменённых файлов: 78 добавлений и 44 удалений

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

@ -227,14 +227,14 @@ static inline int ompi_cb_fifo_free( ompi_cb_fifo_t *fifo,
/* free fifo array */
if( OMPI_CB_NULL != fifo->queue ){
ptr=(char *)(fifo->queue)+(size_t)(memory_allocator->mpool_base(memory_allocator));
memory_allocator->mpool_free(memory_allocator, ptr);
memory_allocator->mpool_free(memory_allocator, ptr, NULL);
fifo->queue=OMPI_CB_NULL;
}
/* free head control structure */
if( OMPI_CB_NULL != fifo->head) {
ptr=(char *)(fifo->head)+(size_t)(memory_allocator->mpool_base(memory_allocator));
memory_allocator->mpool_free(memory_allocator, ptr);
memory_allocator->mpool_free(memory_allocator, ptr, NULL);
fifo->head=OMPI_CB_NULL;
}
@ -242,7 +242,7 @@ static inline int ompi_cb_fifo_free( ompi_cb_fifo_t *fifo,
/* free tail control structure */
if( OMPI_CB_NULL != fifo->tail) {
ptr=(char *)(fifo->tail)+(size_t)(memory_allocator->mpool_base(memory_allocator));
memory_allocator->mpool_free(memory_allocator, ptr);
memory_allocator->mpool_free(memory_allocator, ptr, NULL);
fifo->tail=OMPI_CB_NULL;
}
@ -550,14 +550,14 @@ static inline int ompi_cb_fifo_free_same_base_addr( ompi_cb_fifo_t *fifo,
/* free fifo array */
if( OMPI_CB_NULL != fifo->head ){
ptr=(char *)(fifo->queue);
memory_allocator->mpool_free(memory_allocator, ptr);
memory_allocator->mpool_free(memory_allocator, ptr, NULL);
fifo->queue=OMPI_CB_NULL;
}
/* free head control structure */
if( OMPI_CB_NULL != fifo->head) {
ptr=(char *)(fifo->head);
memory_allocator->mpool_free(memory_allocator, ptr);
memory_allocator->mpool_free(memory_allocator, ptr, NULL);
fifo->head=OMPI_CB_NULL;
}
@ -565,7 +565,7 @@ static inline int ompi_cb_fifo_free_same_base_addr( ompi_cb_fifo_t *fifo,
/* free tail control structure */
if( OMPI_CB_NULL != fifo->tail) {
ptr=(char *)(fifo->tail);
memory_allocator->mpool_free(memory_allocator, ptr);
memory_allocator->mpool_free(memory_allocator, ptr, NULL);
fifo->tail=OMPI_CB_NULL;
}

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

@ -182,7 +182,7 @@ static inline int ompi_fifo_free( ompi_fifo_t *fifo,
ff_tmp=(ompi_cb_fifo_wrapper_t *)ff->next_fifo_wrapper;
/* free the element */
memory_allocator->mpool_free(memory_allocator, ff);
memory_allocator->mpool_free(memory_allocator, ff, NULL);
ff=ff_tmp;

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

@ -130,8 +130,12 @@ int mca_bmi_ib_register(
{
/* TODO add register stuff here... */
mca_bmi_ib_module_t* ib_bmi = (mca_bmi_ib_module_t*) bmi;
OMPI_THREAD_LOCK(&ib->bmi.ib_lock);
ib_bmi->ib_reg[tag].cbfunc = cbfunc;
ib_bmi->ib_reg[tag].cbdata = cbdata;
OMPI_THREAD_UNLOCK(&ib->bmi.ib_lock);
return OMPI_SUCCESS;
}

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

@ -131,8 +131,12 @@ struct mca_bmi_ib_module_t {
ompi_list_t repost; /**< list of buffers to repost */
ompi_mutex_t ib_lock; /**< module level lock */
mca_mpool_base_module_t* ib_pool; /**< ib memory pool */
uint32_t rr_posted_high; /**< number of high priority rr posted to the nic*/
uint32_t rr_posted_low; /**< number of low priority rr posted to the nic*/

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

@ -276,6 +276,8 @@ mca_bmi_base_module_t** mca_bmi_ib_component_init(int *num_bmi_modules,
a distinct bmi module for each hca port */
OBJ_CONSTRUCT(&bmi_list, ompi_list_t);
OBJ_CONSTRUCT(&mca_bmi_ib_component.ib_lock, ompi_mutex_t);
for(i = 0; i < num_hcas; i++){
vapi_ret = EVAPI_get_hca_hndl(hca_ids[i], &hca_hndl);
@ -351,6 +353,8 @@ mca_bmi_base_module_t** mca_bmi_ib_component_init(int *num_bmi_modules,
/* Initialize module state */
OBJ_CONSTRUCT(&ib_bmi->ib_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&ib_bmi->send_free_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&ib_bmi->send_free_max, ompi_free_list_t);
OBJ_CONSTRUCT(&ib_bmi->send_free_frag, ompi_free_list_t);

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

@ -162,6 +162,7 @@ static inline int mca_bmi_ib_endpoint_post_rr_sub(int cnt,
static inline int mca_bmi_ib_endpoint_post_rr( mca_bmi_ib_endpoint_t * endpoint, int additional){
mca_bmi_ib_module_t * ib_bmi = endpoint->endpoint_bmi;
int rc;
OMPI_THREAD_LOCK(&ib_bmi->ib_lock);
if(ib_bmi->rr_posted_high <= mca_bmi_ib_component.ib_rr_buf_min+additional && ib_bmi->rr_posted_high < mca_bmi_ib_component.ib_rr_buf_max){
@ -172,9 +173,10 @@ static inline int mca_bmi_ib_endpoint_post_rr( mca_bmi_ib_endpoint_t * endpoint,
ib_bmi->nic,
endpoint->lcl_qp_hndl_high
);
if(rc != OMPI_SUCCESS)
if(rc != OMPI_SUCCESS){
OMPI_THREAD_UNLOCK(&ib_bmi->ib_lock);
return rc;
}
}
if(ib_bmi->rr_posted_low <= mca_bmi_ib_component.ib_rr_buf_min+additional && ib_bmi->rr_posted_low < mca_bmi_ib_component.ib_rr_buf_max){
@ -185,10 +187,13 @@ static inline int mca_bmi_ib_endpoint_post_rr( mca_bmi_ib_endpoint_t * endpoint,
ib_bmi->nic,
endpoint->lcl_qp_hndl_low
);
if(rc != OMPI_SUCCESS)
if(rc != OMPI_SUCCESS) {
OMPI_THREAD_UNLOCK(&ib_bmi->ib_lock);
return rc;
}
}
OMPI_THREAD_UNLOCK(&ib_bmi->ib_lock);
return OMPI_SUCCESS;

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

@ -107,7 +107,7 @@ OMPI_DECLSPEC extern ompi_list_t mca_mpool_base_components;
OMPI_DECLSPEC extern ompi_list_t mca_mpool_base_modules;
OMPI_DECLSPEC extern ompi_free_list_t mca_mpool_base_mem_list;
OMPI_DECLSPEC extern ompi_rb_tree_t mca_mpool_base_tree;
OMPI_DECLSPEC extern ompi_mutex_t tree_lock;
OMPI_DECLSPEC extern ompi_mutex_t mca_mpool_base_tree_lock;
#if defined(c_plusplus) || defined(__cplusplus)
}

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

@ -27,7 +27,7 @@
ompi_rb_tree_t mca_mpool_base_tree;
ompi_free_list_t mca_mpool_base_mem_list;
ompi_mutex_t tree_lock;
ompi_mutex_t mca_mpool_base_tree_lock;
/**
@ -72,10 +72,10 @@ int mca_mpool_base_insert(void * addr, size_t size,
((mca_mpool_base_chunk_t *) item)->key.top = (void *)
((char *) addr + size - 1);
OMPI_THREAD_LOCK(tree_lock);
OMPI_THREAD_LOCK(mca_mpool_base_tree_lock);
rc = ompi_rb_tree_insert(&mca_mpool_base_tree,
&((mca_mpool_base_chunk_t *)item)->key, item);
OMPI_THREAD_UNLOCK(tree_lock);
OMPI_THREAD_UNLOCK(mca_mpool_base_tree_lock);
if(rc != OMPI_SUCCESS)
return rc;
@ -101,9 +101,9 @@ int mca_mpool_base_remove(void * base)
return OMPI_ERR_BAD_PARAM;
}
OMPI_THREAD_LOCK(tree_lock);
OMPI_THREAD_LOCK(mca_mpool_base_tree_lock);
rc = ompi_rb_tree_delete(&mca_mpool_base_tree, &chunk->key);
OMPI_THREAD_UNLOCK(tree_lock);
OMPI_THREAD_UNLOCK(mca_mpool_base_tree_lock);
if(OMPI_SUCCESS == rc)
return OMPI_SUCCESS;
@ -228,11 +228,11 @@ void * mca_mpool_base_alloc(size_t size, ompi_info_t * info)
((mca_mpool_base_chunk_t *) item)->key.bottom = mem;
((mca_mpool_base_chunk_t *) item)->key.top = (void *)
((char *) mem + size - 1);
OMPI_THREAD_LOCK(tree_lock);
OMPI_THREAD_LOCK(mca_mpool_base_tree_lock);
ompi_rb_tree_insert(&mca_mpool_base_tree,
&((mca_mpool_base_chunk_t *)item)->key, item);
OMPI_THREAD_UNLOCK(tree_lock);
OMPI_THREAD_UNLOCK(mca_mpool_base_tree_lock);
return mem;
}
@ -296,11 +296,11 @@ void * mca_mpool_base_alloc(size_t size, ompi_info_t * info)
{
((mca_mpool_base_chunk_t *) item)->mpools[num_modules].mpool = NULL;
}
OMPI_THREAD_LOCK(tree_lock);
OMPI_THREAD_LOCK(mca_mpool_base_tree_lock);
ompi_rb_tree_insert(&mca_mpool_base_tree,
&((mca_mpool_base_chunk_t *)item)->key, item);
OMPI_THREAD_UNLOCK(tree_lock);
OMPI_THREAD_UNLOCK(mca_mpool_base_tree_lock);
free(has_reg_function);
return mem;
@ -331,9 +331,9 @@ int mca_mpool_base_free(void * base)
free(chunk->key.bottom);
OMPI_FREE_LIST_RETURN(&mca_mpool_base_mem_list, (ompi_list_item_t*) chunk);
OMPI_THREAD_LOCK(tree_lock);
OMPI_THREAD_LOCK(mca_mpool_base_tree_lock);
rc = ompi_rb_tree_delete(&mca_mpool_base_tree, &chunk->key);
OMPI_THREAD_UNLOCK(tree_lock);
OMPI_THREAD_UNLOCK(mca_mpool_base_tree_lock);
if(OMPI_SUCCESS == rc)
return OMPI_SUCCESS;
@ -348,14 +348,16 @@ int mca_mpool_base_free(void * base)
{
chunk->mpools[i].mpool->mpool_deregister(chunk->mpools[i].mpool,
chunk->key.bottom,
((char *) chunk->key.top - (char *) chunk->key.bottom + 1));
((char *) chunk->key.top - (char *) chunk->key.bottom + 1),
chunk->mpools[i].bmi_registration
);
}
chunk->mpools[i].mpool->mpool_free(chunk->mpools[i].mpool, chunk->key.bottom);
chunk->mpools[i].mpool->mpool_free(chunk->mpools[i].mpool, chunk->key.bottom, chunk->mpools[i].bmi_registration);
OMPI_FREE_LIST_RETURN(&mca_mpool_base_mem_list, (ompi_list_item_t *) chunk);
OMPI_THREAD_LOCK(tree_lock);
OMPI_THREAD_LOCK(mca_mpool_base_tree_lock);
rc = ompi_rb_tree_delete(&mca_mpool_base_tree, &chunk->key);
OMPI_THREAD_UNLOCK(tree_lock);
OMPI_THREAD_UNLOCK(mca_mpool_base_tree_lock);
if(OMPI_SUCCESS == rc)
return OMPI_SUCCESS;

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

@ -48,7 +48,7 @@ int mca_mpool_base_init(bool enable_progress_threads, bool enable_mpi_threads)
ompi_free_list_init(&mca_mpool_base_mem_list, sizeof(mca_mpool_base_chunk_t),
OBJ_CLASS(mca_mpool_base_chunk_t), 0, -1 , 128, NULL);
OBJ_CONSTRUCT(&mca_mpool_base_tree, ompi_rb_tree_t);
OBJ_CONSTRUCT(&tree_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&mca_mpool_base_tree_lock, ompi_mutex_t);
return ompi_rb_tree_init(&mca_mpool_base_tree, mca_mpool_base_tree_node_compare);
}

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

@ -56,7 +56,8 @@ typedef void* (*mca_mpool_base_module_realloc_fn_t)(
*/
typedef void (*mca_mpool_base_module_free_fn_t)(
struct mca_mpool_base_module_t* mpool,
void *);
void *,
struct mca_mpool_base_registration_t* registration);
/**
* register memory
@ -73,7 +74,8 @@ typedef int (*mca_mpool_base_module_register_fn_t)(
typedef int (*mca_mpool_base_module_deregister_fn_t)(
struct mca_mpool_base_module_t* mpool,
void * addr,
size_t size);
size_t size,
struct mca_bmi_base_registration_t* registration);
/**
* if appropriate - returns base address of memory pool

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

@ -82,7 +82,8 @@ void* mca_mpool_sm_realloc(
*/
void mca_mpool_sm_free(
mca_mpool_base_module_t* mpool,
void *);
void * addr,
struct mca_bmi_base_registration_t* registration);
#if defined(c_plusplus) || defined(__cplusplus)

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

@ -74,7 +74,8 @@ void* mca_mpool_sm_realloc(
/**
* free function
*/
void mca_mpool_sm_free(mca_mpool_base_module_t* mpool, void * addr)
void mca_mpool_sm_free(mca_mpool_base_module_t* mpool, void * addr,
struct mca_bmi_base_registration_t* registration)
{
mca_mpool_sm_module_t* mpool_sm = (mca_mpool_sm_module_t*)mpool;
mpool_sm->sm_allocator->alc_free(mpool_sm->sm_allocator, addr);

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

@ -56,7 +56,6 @@ struct mca_mpool_vapi_module_t {
mca_mpool_base_module_t super;
mca_allocator_base_module_t * vapi_allocator;
mca_bmi_base_resources_t hca_pd;
mca_bmi_base_registration_t mem_hndl;
}; typedef struct mca_mpool_vapi_module_t mca_mpool_vapi_module_t;
/*
@ -100,13 +99,16 @@ int mca_mpool_vapi_register(
int mca_mpool_vapi_deregister(
mca_mpool_base_module_t* mpool,
void *addr,
size_t size);
size_t size,
struct mca_bmi_base_registration_t* );
/**
* free function typedef
*/
void mca_mpool_vapi_free(mca_mpool_base_module_t* mpool, void *);
void mca_mpool_vapi_free(mca_mpool_base_module_t* mpool,
void * addr,
struct mca_bmi_base_registration_t* registration);
void* mca_common_vapi_segment_alloc(
struct mca_mpool_base_module_t* module,

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

@ -105,20 +105,22 @@ int mca_mpool_vapi_register(mca_mpool_base_module_t* mpool, void *addr, size_t s
/*
* deregister memory
*/
int mca_mpool_vapi_deregister(mca_mpool_base_module_t* mpool, void *addr, size_t size){
int mca_mpool_vapi_deregister(mca_mpool_base_module_t* mpool, void *addr, size_t size,
struct mca_bmi_base_registration_t* registration){
VAPI_ret_t ret;
mca_mpool_vapi_module_t * mpool_vapi = (mca_mpool_vapi_module_t*) mpool;
ret = VAPI_deregister_mr(
mpool_vapi->hca_pd.hca,
mpool_vapi->mem_hndl.hndl
registration->hndl
);
if(VAPI_OK != ret){
ompi_output(0, "%s: error unpinning vapi memory\n", __func__);
return OMPI_ERROR;
}
free(registration);
return OMPI_SUCCESS;
}
@ -138,10 +140,15 @@ void* mca_mpool_vapi_realloc(
/**
* free function
*/
void mca_mpool_vapi_free(mca_mpool_base_module_t* mpool, void * addr)
void mca_mpool_vapi_free(mca_mpool_base_module_t* mpool, void * addr,
struct mca_bmi_base_registration_t* registration)
{
mca_mpool_vapi_module_t* mpool_vapi = (mca_mpool_vapi_module_t*)mpool;
mpool_vapi->super.mpool_deregister(mpool, addr, 0, registration);
mpool_vapi->vapi_allocator->alc_free(mpool_vapi->vapi_allocator, addr);
}
@ -161,4 +168,6 @@ void mca_mpool_vapi_free(mca_mpool_base_module_t* mpool, void * addr)