1
1

- Modified the mpool interface to use mca_mpool_base_registration_t instead of

-mca_bmi_base_registration_t 


- Also corrected a bug in mca_common_sm_mmap_seg_alloc where a unitialized
-pointer was dereferenced 

- Misc other changes.  

This commit was SVN r6145.
Этот коммит содержится в:
Galen Shipman 2005-06-23 15:53:51 +00:00
родитель 568bac7e4e
Коммит e0b265885d
33 изменённых файлов: 191 добавлений и 129 удалений

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

@ -75,7 +75,7 @@ int ompi_free_list_grow(ompi_free_list_t* flist, size_t num_elements)
unsigned char* ptr;
size_t i;
size_t mod;
struct mca_bmi_base_registration_t* user_out;
struct mca_mpool_base_registration_t* user_out;
if (flist->fl_max_to_alloc > 0 && flist->fl_num_allocated + num_elements > flist->fl_max_to_alloc)
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;

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

@ -188,6 +188,27 @@ void * ompi_rb_tree_find(ompi_rb_tree_t *tree, void *key)
return(NULL);
}
/* Finds the node in the tree based on the key */
void * ompi_rb_tree_find_with_cmp(ompi_rb_tree_t *tree,
void *key,
ompi_rb_tree_comp_fn_t* comp)
{
ompi_rb_tree_node_t * node;
int compvalue;
node = tree->root_ptr->left;
while (node != tree->nill) {
compvalue = (*comp)(key, node->key);
/* if the result of the comparison function is 0, we found it */
if (compvalue == 0) {
return(node->value);
}
/* else if it is less than 0, go left, else right */
(compvalue < 0) ? (node = node->left) : (node = node->right);
}
/* if we didn't find anything, return NULL */
return(NULL);
}
/* Finds the node in the tree based on the key and returns a pointer
* to the node. This is a bit a code duplication, but this has to be fast
* so we go ahead with the duplication */

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

@ -21,8 +21,8 @@
#define MCA_ALLOCATOR_H
#include "mca/mca.h"
struct mca_bmi_base_registration_t;
struct mca_bmi_base_resources_t;
struct mca_mpool_base_registration_t;
struct mca_mpool_base_resources_t;
#if defined(c_plusplus) || defined(__cplusplus)
@ -38,7 +38,7 @@ typedef void* (*mca_allocator_base_module_alloc_fn_t)(
struct mca_allocator_base_module_t*,
size_t size,
size_t align,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* The realloc function typedef
@ -46,7 +46,7 @@ typedef void* (*mca_allocator_base_module_alloc_fn_t)(
typedef void* (*mca_allocator_base_module_realloc_fn_t)(
struct mca_allocator_base_module_t*,
void*, size_t,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* Free function typedef
@ -103,7 +103,7 @@ typedef struct mca_allocator_base_module_t mca_allocator_base_module_t;
typedef void* (*mca_allocator_base_component_segment_alloc_fn_t)(
struct mca_mpool_base_module_t* module,
size_t* size,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* A function to free memory from the control of the allocator framework

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

@ -161,7 +161,7 @@ void *mca_allocator_basic_alloc(
mca_allocator_base_module_t * base,
size_t size,
size_t align,
struct mca_bmi_base_registration_t** registration)
struct mca_mpool_base_registration_t** registration)
{
mca_allocator_basic_module_t* module = (mca_allocator_basic_module_t*)base;
mca_allocator_basic_segment_t* seg;
@ -241,7 +241,7 @@ void * mca_allocator_basic_realloc(
mca_allocator_base_module_t * base,
void * ptr,
size_t size,
struct mca_bmi_base_registration_t** registration)
struct mca_mpool_base_registration_t** registration)
{
unsigned char* addr = ((unsigned char*)ptr) - sizeof(size_t);
size_t alloc_size = *(size_t*)addr;

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

@ -92,7 +92,7 @@ mca_allocator_base_module_t* mca_allocator_basic_component_init(
mca_allocator_base_module_t * mem,
size_t size,
size_t align,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* Attempts to resize the passed region of memory into a larger or a smaller
@ -112,7 +112,7 @@ mca_allocator_base_module_t* mca_allocator_basic_component_init(
mca_allocator_base_module_t * mem,
void * ptr,
size_t size,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* Frees the passed region of memory

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

@ -34,7 +34,7 @@ int mca_allocator_bucket_module_close(void);
void * mca_allocator_bucket_alloc_wrapper(
struct mca_allocator_base_module_t* allocator,
size_t size, size_t align,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
static int mca_allocator_num_buckets;
@ -91,7 +91,7 @@ void * mca_allocator_bucket_alloc_wrapper(
struct mca_allocator_base_module_t* allocator,
size_t size,
size_t align,
struct mca_bmi_base_registration_t** registration)
struct mca_mpool_base_registration_t** registration)
{
if(0 == align){
return(mca_allocator_bucket_alloc(allocator, size, registration));

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

@ -71,7 +71,7 @@ mca_allocator_bucket_t * mca_allocator_bucket_init(
void * mca_allocator_bucket_alloc(
mca_allocator_base_module_t * mem,
size_t size,
struct mca_bmi_base_registration_t** registration)
struct mca_mpool_base_registration_t** registration)
{
mca_allocator_bucket_t * mem_options = (mca_allocator_bucket_t *) mem;
/* initialize for the later bit shifts */
@ -154,7 +154,7 @@ void * mca_allocator_bucket_alloc_align(
mca_allocator_base_module_t * mem,
size_t size,
size_t alignment,
struct mca_bmi_base_registration_t** registration)
struct mca_mpool_base_registration_t** registration)
{
mca_allocator_bucket_t * mem_options = (mca_allocator_bucket_t *) mem;
int bucket_num = 1;
@ -237,7 +237,7 @@ void * mca_allocator_bucket_realloc(
mca_allocator_base_module_t * mem,
void * ptr,
size_t size,
struct mca_bmi_base_registration_t** registration)
struct mca_mpool_base_registration_t** registration)
{
mca_allocator_bucket_t * mem_options = (mca_allocator_bucket_t *) mem;
/* initialize for later bit shifts */

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

@ -125,7 +125,7 @@ typedef struct mca_allocator_bucket_t mca_allocator_bucket_t;
void * mca_allocator_bucket_alloc(
mca_allocator_base_module_t * mem,
size_t size,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* Accepts a request for memory in a specific region defined by the
@ -146,7 +146,7 @@ typedef struct mca_allocator_bucket_t mca_allocator_bucket_t;
mca_allocator_base_module_t * mem,
size_t size,
size_t alignment,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* Attempts to resize the passed region of memory into a larger or a smaller
@ -166,7 +166,7 @@ typedef struct mca_allocator_bucket_t mca_allocator_bucket_t;
mca_allocator_base_module_t * mem,
void * ptr,
size_t size,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* Frees the passed region of memory

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

@ -119,8 +119,8 @@
struct mca_bmi_base_module_t;
struct mca_bmi_base_endpoint_t;
struct mca_bmi_base_descriptor_t;
struct mca_bmi_base_registration_t;
struct mca_bmi_base_resources_t;
struct mca_mpool_base_registration_t;
struct mca_mpool_base_resources_t;
/* send/recv operations require tag matching */
@ -410,7 +410,7 @@ typedef int (*mca_bmi_base_module_free_fn_t)(
typedef struct mca_bmi_base_descriptor_t* (*mca_bmi_base_module_prepare_fn_t)(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_registration_t* registration,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size

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

@ -58,6 +58,8 @@ mca_bmi_ib_module_t mca_bmi_ib_module = {
}
};
int mca_bmi_ib_add_procs(
struct mca_bmi_base_module_t* bmi,
size_t nprocs,
@ -221,7 +223,7 @@ int mca_bmi_ib_free(
mca_bmi_base_descriptor_t* mca_bmi_ib_prepare_src(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_registration_t* registration,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size
@ -330,10 +332,16 @@ mca_bmi_base_descriptor_t* mca_bmi_ib_prepare_src(
reg_len = (unsigned char*)registration->bound - (unsigned char*)iov.iov_base + 1;
if(frag->segment.seg_len > reg_len) {
frag->ret = VAPI_deregister_mr(
ib_bmi->nic,
registration->hndl
);
ib_bmi->ib_pool->mpool_deregister(
ib_bmi->ib_pool,
registration->base,
0,
registration);
/* frag->ret = VAPI_deregister_mr( */
/* ib_bmi->nic, */
/* registration->hndl */
/* ); */
mca_mpool_base_remove((void*) registration->base);
@ -355,7 +363,7 @@ mca_bmi_base_descriptor_t* mca_bmi_ib_prepare_src(
rc = mca_mpool_base_insert(iov.iov_base,
iov.iov_len,
ib_bmi->ib_pool,
&ib_bmi->super,
(void*) (&ib_bmi->super),
registration);
if(rc != OMPI_SUCCESS)
return NULL;
@ -391,7 +399,7 @@ mca_bmi_base_descriptor_t* mca_bmi_ib_prepare_src(
mca_bmi_base_descriptor_t* mca_bmi_ib_prepare_dst(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_registration_t* registration,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size)
@ -414,11 +422,16 @@ mca_bmi_base_descriptor_t* mca_bmi_ib_prepare_dst(
frag->segment.seg_addr.pval = convertor->pBaseBuf + convertor->bConverted;
if(NULL!= registration){
if(frag->segment.seg_len > reg_len) {
frag->ret = VAPI_deregister_mr(
ib_bmi->nic,
registration->hndl
);
ib_bmi->ib_pool->mpool_deregister(
ib_bmi->ib_pool,
registration->base,
0,
registration);
/* frag->ret = VAPI_deregister_mr( */
/* ib_bmi->nic, */
/* registration->hndl */
/* ); */
mca_mpool_base_remove((void*) registration->base);
@ -440,7 +453,7 @@ mca_bmi_base_descriptor_t* mca_bmi_ib_prepare_dst(
rc = mca_mpool_base_insert(frag->segment.seg_addr.pval,
*size,
ib_bmi->ib_pool,
&ib_bmi->super,
(void*) (&ib_bmi->super),
(void*) registration);
if(rc != OMPI_SUCCESS)
return NULL;

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

@ -343,7 +343,7 @@ extern int mca_bmi_ib_free(
mca_bmi_base_descriptor_t* mca_bmi_ib_prepare_src(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* peer,
struct mca_bmi_base_registration_t* registration,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size
@ -359,7 +359,7 @@ mca_bmi_base_descriptor_t* mca_bmi_ib_prepare_src(
extern mca_bmi_base_descriptor_t* mca_bmi_ib_prepare_dst(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* peer,
struct mca_bmi_base_registration_t* registration,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size);

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

@ -242,7 +242,7 @@ mca_bmi_base_module_t** mca_bmi_ib_component_init(int *num_bmi_modules,
uint32_t num_hcas;
mca_bmi_base_module_t** bmis;
uint32_t i,j, length;
mca_bmi_base_resources_t hca_pd;
mca_mpool_base_resources_t hca_pd;
ompi_list_t bmi_list;
mca_bmi_ib_module_t * ib_bmi;
mca_bmi_base_selected_module_t* ib_selected;

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

@ -6,7 +6,7 @@
static void mca_bmi_ib_frag_common_constructor( mca_bmi_ib_frag_t* frag)
{
mca_bmi_base_registration_t* mem_hndl = frag->base.super.user_data;
mca_mpool_base_registration_t* mem_hndl = frag->base.super.user_data;
frag->hdr = (mca_bmi_ib_header_t*) (frag+1); /* initialize the bmi header to point to start at end of frag */
#if 0
mod = (unsigned long) frag->hdr % MCA_BMI_IB_FRAG_ALIGN;

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

@ -186,7 +186,7 @@ extern int mca_bmi_self_free(
struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_src(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_registration_t* registration,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size)
@ -252,7 +252,7 @@ struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_src(
struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_dst(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_registration_t* registration,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size)

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

@ -206,7 +206,7 @@ extern int mca_bmi_self_free(
struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_src(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_registration_t* registration,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size
@ -221,7 +221,7 @@ struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_src(
struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_dst(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_registration_t* registration,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size

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

@ -776,7 +776,7 @@ extern int mca_bmi_sm_free(
struct mca_bmi_base_descriptor_t* mca_bmi_sm_prepare_src(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_registration_t* registration,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size)

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

@ -300,7 +300,7 @@ extern int mca_bmi_sm_free(
struct mca_bmi_base_descriptor_t* mca_bmi_sm_prepare_src(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_registration_t* registration,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size

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

@ -216,7 +216,7 @@ mca_common_sm_mmap_t* mca_common_sm_mmap_init(size_t size, char *file_name,
void* mca_common_sm_mmap_seg_alloc(
struct mca_mpool_base_module_t* mpool,
size_t* size,
struct mca_bmi_base_registration_t** registration)
struct mca_mpool_base_registration_t** registration)
{
mca_common_sm_mmap_t* map = mca_common_sm_mmap;
mca_common_sm_file_header_t* seg = map->map_seg;
@ -230,7 +230,6 @@ void* mca_common_sm_mmap_seg_alloc(
addr = map->data_addr + seg->seg_offset;
seg->seg_offset += *size;
}
*registration = NULL;
ompi_atomic_unlock(&seg->seg_lock);
return addr;
}

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

@ -27,7 +27,7 @@ extern "C" {
#endif
struct mca_mpool_base_module_t;
struct mca_bmi_base_registration_t;
struct mca_mpool_base_registration_t;
struct mca_common_sm_file_header_t {
@ -99,7 +99,7 @@ extern mca_common_sm_mmap_t* mca_common_sm_mmap_init(
extern void* mca_common_sm_mmap_seg_alloc(
struct mca_mpool_base_module_t* mpool,
size_t* size,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/*
* Instance that is shared between components that use shared memory

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

@ -27,14 +27,14 @@ extern "C" {
#endif
struct mca_bmi_base_resources_t {
struct mca_mpool_base_resources_t {
VAPI_hca_hndl_t hca; /* the hca (nic) */
VAPI_pd_hndl_t pd_tag; /* the protection domain */
};
typedef struct mca_bmi_base_resources_t mca_bmi_base_resources_t;
typedef struct mca_mpool_base_resources_t mca_mpool_base_resources_t;
struct mca_bmi_base_registration_t {
struct mca_mpool_base_registration_t {
VAPI_mr_hndl_t hndl;
/* Memory region handle */
@ -49,7 +49,7 @@ struct mca_bmi_base_registration_t {
void * bound;
};
typedef struct mca_bmi_base_registration_t mca_bmi_base_registration_t;
typedef struct mca_mpool_base_registration_t mca_mpool_base_registration_t;
#if defined(c_plusplus) || defined(__cplusplus)
}

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

@ -32,11 +32,11 @@ extern "C" {
#endif
struct mca_mpool_base_selected_module_t {
ompi_list_item_t super;
mca_mpool_base_component_t *mpool_component;
mca_mpool_base_module_t *mpool_module;
struct mca_bmi_base_module_t *mpool_bmi;
struct mca_bmi_base_resources_t *mpool_resources;
ompi_list_item_t super;
mca_mpool_base_component_t *mpool_component;
mca_mpool_base_module_t *mpool_module;
void* user_data;
struct mca_mpool_base_resources_t *mpool_resources;
};
typedef struct mca_mpool_base_selected_module_t mca_mpool_base_selected_module_t;
@ -68,8 +68,8 @@ typedef struct mca_mpool_base_key_t mca_mpool_base_key_t;
struct mca_mpool_base_reg_mpool_t
{
mca_mpool_base_module_t * mpool; /**< the registered memory pool */
struct mca_bmi_base_module_t *bmi_module; /**< bmi that registered the memory */
struct mca_bmi_base_registration_t* bmi_registration; /**< bmi specific info associated w/ registration */
void* user_data; /**< user data */
struct mca_mpool_base_registration_t* mpool_registration; /**< mpool specific info associated w/ registration */
};
typedef struct mca_mpool_base_reg_mpool_t mca_mpool_base_reg_mpool_t;
@ -96,8 +96,8 @@ OMPI_DECLSPEC int mca_mpool_base_close(void);
OMPI_DECLSPEC mca_mpool_base_component_t* mca_mpool_base_component_lookup(const char* name);
OMPI_DECLSPEC mca_mpool_base_module_t* mca_mpool_base_module_create(
const char* name,
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_resources_t* bmi_resources);
void* user_data,
struct mca_mpool_base_resources_t* mpool_resources);
/*
* Globals

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

@ -60,8 +60,8 @@ int mca_mpool_base_tree_node_compare(void * key1, void * key2)
int mca_mpool_base_insert(void * addr, size_t size,
mca_mpool_base_module_t* mpool,
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_registration_t* registration)
void* user_data,
struct mca_mpool_base_registration_t* registration)
{
ompi_list_item_t *item;
int rc;
@ -80,8 +80,8 @@ int mca_mpool_base_insert(void * addr, size_t size,
if(rc != OMPI_SUCCESS)
return rc;
((mca_mpool_base_chunk_t *) item)->mpools[0].mpool = mpool;
((mca_mpool_base_chunk_t *) item)->mpools[0].bmi_module = bmi;
((mca_mpool_base_chunk_t *) item)->mpools[0].bmi_registration = registration;
((mca_mpool_base_chunk_t *) item)->mpools[0].user_data = user_data;
((mca_mpool_base_chunk_t *) item)->mpools[0].mpool_registration = registration;
return OMPI_SUCCESS;
}
@ -143,7 +143,7 @@ void * mca_mpool_base_alloc(size_t size, ompi_info_t * info)
mca_mpool_base_selected_module_t * no_reg_function = NULL;
mca_mpool_base_selected_module_t ** has_reg_function = (mca_mpool_base_selected_module_t **)
malloc(num_modules * sizeof(mca_mpool_base_module_t *));
struct mca_bmi_base_registration_t * registration;
struct mca_mpool_base_registration_t * registration;
void * mem = NULL;
char * key;
bool match_found;
@ -253,8 +253,8 @@ 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);
((mca_mpool_base_chunk_t *) item)->mpools[num_modules].mpool = mpool;
((mca_mpool_base_chunk_t *) item)->mpools[num_modules].bmi_module = no_reg_function->mpool_bmi;
((mca_mpool_base_chunk_t *) item)->mpools[num_modules++].bmi_registration = registration;
((mca_mpool_base_chunk_t *) item)->mpools[num_modules].user_data = (void*) no_reg_function->user_data;
((mca_mpool_base_chunk_t *) item)->mpools[num_modules++].mpool_registration = registration;
num_modules++;
}
else
@ -264,8 +264,8 @@ 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);
((mca_mpool_base_chunk_t *) item)->mpools[num_modules].mpool = mpool;
((mca_mpool_base_chunk_t *) item)->mpools[num_modules].bmi_module = has_reg_function[i]->mpool_bmi;
((mca_mpool_base_chunk_t *) item)->mpools[num_modules++].bmi_registration = registration;
((mca_mpool_base_chunk_t *) item)->mpools[num_modules].user_data = has_reg_function[i]->user_data;
((mca_mpool_base_chunk_t *) item)->mpools[num_modules++].mpool_registration = registration;
i++;
num_modules++;
}
@ -286,8 +286,8 @@ void * mca_mpool_base_alloc(size_t size, ompi_info_t * info)
return NULL;
}
((mca_mpool_base_chunk_t *) item)->mpools[num_modules].mpool = mpool;
((mca_mpool_base_chunk_t *) item)->mpools[num_modules].bmi_module = has_reg_function[i]->mpool_bmi;
((mca_mpool_base_chunk_t *) item)->mpools[num_modules].bmi_registration = registration;
((mca_mpool_base_chunk_t *) item)->mpools[num_modules].user_data = has_reg_function[i]->user_data;
((mca_mpool_base_chunk_t *) item)->mpools[num_modules].mpool_registration = registration;
num_modules++;
i++;
}
@ -349,10 +349,10 @@ 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),
chunk->mpools[i].bmi_registration
chunk->mpools[i].mpool_registration
);
}
chunk->mpools[i].mpool->mpool_free(chunk->mpools[i].mpool, chunk->key.bottom, chunk->mpools[i].bmi_registration);
chunk->mpools[i].mpool->mpool_free(chunk->mpools[i].mpool, chunk->key.bottom, chunk->mpools[i].mpool_registration);
OMPI_FREE_LIST_RETURN(&mca_mpool_base_mem_list, (ompi_list_item_t *) chunk);
OMPI_THREAD_LOCK(mca_mpool_base_tree_lock);
@ -381,3 +381,38 @@ struct mca_mpool_base_chunk_t * mca_mpool_base_find(void * base)
ompi_rb_tree_find(&mca_mpool_base_tree, &base);
}
/* int mca_bmi_ib_tree_node_compare_range(void * key1, void * key2) */
/* { */
/* if(((mca_mpool_base_key_t *) key1)->bottom < */
/* ((mca_mpool_base_key_t *) key2)->bottom) */
/* { */
/* return -1; */
/* } */
/* else if((((mca_mpool_base_key_t *) key1)->bottom + ((mca_mpool_base_key_t *) key1)->length) > */
/* ((mca_mpool_base_key_t *) key2)->top) */
/* { */
/* return 1; */
/* } */
/* else */
/* { */
/* return 0; */
/* } */
/* } */
/* /\** */
/* * Searches the mpool to see if it has allocated the memory that is passed in. */
/* * If so it returns an array of mpools the memory is registered with. */
/* * */
/* * @param base pointer to the memory to lookup */
/* * */
/* * @retval NULL if the memory is not in any mpool */
/* * @retval pointer to an array of type mca_mpool_base_reg_mpool_t */
/* *\/ */
/* struct mca_mpool_base_chunk_t * mca_mpool_base_find_range(void * base) */
/* { */
/* return (mca_mpool_base_chunk_t *) */
/* ompi_rb_tree_find(&mca_mpool_base_tree, &base); */
/* } */

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

@ -46,8 +46,8 @@ mca_mpool_base_component_t* mca_mpool_base_component_lookup(const char* name)
mca_mpool_base_module_t* mca_mpool_base_module_create(
const char* name,
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_resources_t* resources)
void* user_data,
struct mca_mpool_base_resources_t* resources)
{
mca_mpool_base_component_t* component = NULL;
@ -69,11 +69,11 @@ mca_mpool_base_module_t* mca_mpool_base_module_create(
if(NULL == component)
return NULL;
module = component->mpool_init(bmi,resources);
module = component->mpool_init(resources);
sm = OBJ_NEW(mca_mpool_base_selected_module_t);
sm->mpool_component = component;
sm->mpool_module = module;
sm->mpool_bmi = bmi;
sm->user_data = user_data;
sm->mpool_resources = resources;
ompi_list_append(&mca_mpool_base_modules, (ompi_list_item_t*) sm);
return module;

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

@ -21,17 +21,15 @@
#define MCA_MPOOL_H
#include "mca/mca.h"
#include "info/info.h"
struct mca_mpool_t;
struct mca_bmi_base_module_t;
struct mca_bmi_base_resources_t;
struct mca_bmi_base_registration_t;
struct mca_mpool_base_resources_t;
struct mca_mpool_base_registration_t;
/**
* component initialize
*/
typedef struct mca_mpool_base_module_t* (*mca_mpool_base_component_init_fn_t)(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_resources_t*);
struct mca_mpool_base_resources_t*);
/**
* allocate function typedef
@ -40,7 +38,7 @@ typedef void* (*mca_mpool_base_module_alloc_fn_t)(
struct mca_mpool_base_module_t* mpool,
size_t size,
size_t align,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* realloc function typedef
@ -49,7 +47,7 @@ typedef void* (*mca_mpool_base_module_realloc_fn_t)(
struct mca_mpool_base_module_t* mpool,
void* addr,
size_t size,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* free function typedef
@ -57,7 +55,7 @@ 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 *addr,
struct mca_bmi_base_registration_t* registration);
struct mca_mpool_base_registration_t* registration);
/**
* register memory
@ -66,7 +64,7 @@ typedef int (*mca_mpool_base_module_register_fn_t)(
struct mca_mpool_base_module_t* mpool,
void * addr,
size_t size,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* deregister memory
@ -75,7 +73,7 @@ typedef int (*mca_mpool_base_module_deregister_fn_t)(
struct mca_mpool_base_module_t* mpool,
void * addr,
size_t size,
struct mca_bmi_base_registration_t* registration);
struct mca_mpool_base_registration_t* registration);
/**
* if appropriate - returns base address of memory pool
@ -187,8 +185,8 @@ OMPI_DECLSPEC int mca_mpool_base_insert(
void * addr,
size_t size,
mca_mpool_base_module_t* mpool,
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_registration_t* registration);
void* user_in,
struct mca_mpool_base_registration_t* registration);
OMPI_DECLSPEC int mca_mpool_base_remove(void * base);

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

@ -66,7 +66,7 @@ void* mca_mpool_sm_alloc(
mca_mpool_base_module_t* mpool,
size_t size,
size_t align,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* realloc function typedef
@ -75,7 +75,7 @@ void* mca_mpool_sm_realloc(
mca_mpool_base_module_t* mpool,
void* addr,
size_t size,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* free function typedef
@ -83,7 +83,7 @@ void* mca_mpool_sm_realloc(
void mca_mpool_sm_free(
mca_mpool_base_module_t* mpool,
void * addr,
struct mca_bmi_base_registration_t* registration);
struct mca_mpool_base_registration_t* registration);
#if defined(c_plusplus) || defined(__cplusplus)

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

@ -29,8 +29,7 @@
*/
static int mca_mpool_sm_open(void);
static mca_mpool_base_module_t* mca_mpool_sm_init(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_resources_t* resources);
struct mca_mpool_base_resources_t* resources);
mca_mpool_sm_component_t mca_mpool_sm_component = {
{
@ -98,8 +97,7 @@ static int mca_mpool_sm_open(void)
static mca_mpool_base_module_t* mca_mpool_sm_init(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_resources_t* resources)
struct mca_mpool_base_resources_t* resources)
{
char *file_name;
int len;

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

@ -52,7 +52,7 @@ void* mca_mpool_sm_alloc(
mca_mpool_base_module_t* mpool,
size_t size,
size_t align,
struct mca_bmi_base_registration_t** registration)
struct mca_mpool_base_registration_t** registration)
{
mca_mpool_sm_module_t* mpool_sm = (mca_mpool_sm_module_t*)mpool;
return mpool_sm->sm_allocator->alc_alloc(mpool_sm->sm_allocator, size, align, registration);
@ -65,7 +65,7 @@ void* mca_mpool_sm_realloc(
mca_mpool_base_module_t* mpool,
void* addr,
size_t size,
struct mca_bmi_base_registration_t** registration)
struct mca_mpool_base_registration_t** registration)
{
mca_mpool_sm_module_t* mpool_sm = (mca_mpool_sm_module_t*)mpool;
return mpool_sm->sm_allocator->alc_realloc(mpool_sm->sm_allocator, addr, size, registration);
@ -75,7 +75,7 @@ void* mca_mpool_sm_realloc(
* free function
*/
void mca_mpool_sm_free(mca_mpool_base_module_t* mpool, void * addr,
struct mca_bmi_base_registration_t* registration)
struct mca_mpool_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);

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

@ -55,7 +55,7 @@ OMPI_COMP_EXPORT extern mca_mpool_vapi_component_t mca_mpool_vapi_component;
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_mpool_base_resources_t hca_pd;
}; typedef struct mca_mpool_vapi_module_t mca_mpool_vapi_module_t;
/*
@ -76,7 +76,7 @@ void* mca_mpool_vapi_alloc(
mca_mpool_base_module_t* mpool,
size_t size,
size_t align,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* realloc function typedef
@ -85,7 +85,7 @@ void* mca_mpool_vapi_realloc(
mca_mpool_base_module_t* mpool,
void* addr,
size_t size,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
/**
* register function typedef
@ -94,13 +94,13 @@ int mca_mpool_vapi_register(
mca_mpool_base_module_t* mpool,
void *addr,
size_t size,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
int mca_mpool_vapi_deregister(
mca_mpool_base_module_t* mpool,
void *addr,
size_t size,
struct mca_bmi_base_registration_t* );
struct mca_mpool_base_registration_t* );
/**
@ -108,12 +108,12 @@ int mca_mpool_vapi_deregister(
*/
void mca_mpool_vapi_free(mca_mpool_base_module_t* mpool,
void * addr,
struct mca_bmi_base_registration_t* registration);
struct mca_mpool_base_registration_t* registration);
void* mca_common_vapi_segment_alloc(
struct mca_mpool_base_module_t* module,
size_t* size,
struct mca_bmi_base_registration_t** registration);
struct mca_mpool_base_registration_t** registration);
#if defined(c_plusplus) || defined(__cplusplus)
}

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

@ -29,8 +29,7 @@
*/
static int mca_mpool_vapi_open(void);
static mca_mpool_base_module_t* mca_mpool_vapi_init(
struct mca_bmi_base_module_t* module,
struct mca_bmi_base_resources_t* resources);
struct mca_mpool_base_resources_t* resources);
mca_mpool_vapi_component_t mca_mpool_vapi_component = {
{
@ -92,7 +91,7 @@ static int mca_mpool_vapi_open(void)
void* mca_common_vapi_segment_alloc(
struct mca_mpool_base_module_t* mpool,
size_t* size,
struct mca_bmi_base_registration_t** registration)
struct mca_mpool_base_registration_t** registration)
{
void* addr_malloc = (void*)malloc((*size) + mca_mpool_vapi_component.page_size);
void* addr = (void*) ALIGN_ADDR(addr_malloc, mca_mpool_vapi_component.page_size_log);
@ -105,8 +104,7 @@ void* mca_common_vapi_segment_alloc(
/* Allocates a segment of memory and registers with IB, user_out returns the memory handle. */
static mca_mpool_base_module_t* mca_mpool_vapi_init(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_resources_t* resources)
struct mca_mpool_base_resources_t* resources)
{
mca_mpool_vapi_module_t* mpool_module;
mca_allocator_base_component_t* allocator_component;

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

@ -44,7 +44,7 @@ void* mca_mpool_vapi_alloc(
mca_mpool_base_module_t* mpool,
size_t size,
size_t align,
struct mca_bmi_base_registration_t** registration)
struct mca_mpool_base_registration_t** registration)
{
mca_mpool_vapi_module_t* mpool_vapi = (mca_mpool_vapi_module_t*)mpool;
return mpool_vapi->vapi_allocator->alc_alloc(mpool_vapi->vapi_allocator, size, align, registration);
@ -55,20 +55,20 @@ void* mca_mpool_vapi_alloc(
* register memory
*/
int mca_mpool_vapi_register(mca_mpool_base_module_t* mpool, void *addr, size_t size,
struct mca_bmi_base_registration_t** registration){
struct mca_mpool_base_registration_t** registration){
mca_mpool_vapi_module_t * mpool_module = (mca_mpool_vapi_module_t*) mpool;
VAPI_mrw_t mr_in, mr_out;
VAPI_ret_t ret;
mca_bmi_base_registration_t* mem_hndl;
mca_mpool_base_registration_t* mem_hndl;
memset(&mr_in, 0, sizeof(VAPI_mrw_t));
memset(&mr_out, 0, sizeof(VAPI_mrw_t));
*registration = (void*) malloc(sizeof(mca_bmi_base_registration_t));
mem_hndl = (mca_bmi_base_registration_t*) *registration;
memset(mem_hndl, 0, sizeof(mca_bmi_base_registration_t*));
*registration = (void*) malloc(sizeof(mca_mpool_base_registration_t));
mem_hndl = (mca_mpool_base_registration_t*) *registration;
memset(mem_hndl, 0, sizeof(mca_mpool_base_registration_t*));
mem_hndl->hndl = VAPI_INVAL_HNDL;
@ -106,7 +106,7 @@ 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,
struct mca_bmi_base_registration_t* registration){
struct mca_mpool_base_registration_t* registration){
VAPI_ret_t ret;
mca_mpool_vapi_module_t * mpool_vapi = (mca_mpool_vapi_module_t*) mpool;
@ -131,7 +131,7 @@ void* mca_mpool_vapi_realloc(
mca_mpool_base_module_t* mpool,
void* addr,
size_t size,
struct mca_bmi_base_registration_t** registration)
struct mca_mpool_base_registration_t** registration)
{
mca_mpool_vapi_module_t* mpool_vapi = (mca_mpool_vapi_module_t*)mpool;
return mpool_vapi->vapi_allocator->alc_realloc( mpool_vapi->vapi_allocator, addr, size, registration);
@ -141,7 +141,7 @@ void* mca_mpool_vapi_realloc(
* free function
*/
void mca_mpool_vapi_free(mca_mpool_base_module_t* mpool, void * addr,
struct mca_bmi_base_registration_t* registration)
struct mca_mpool_base_registration_t* registration)
{
mca_mpool_vapi_module_t* mpool_vapi = (mca_mpool_vapi_module_t*)mpool;

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

@ -45,7 +45,7 @@ static int32_t mca_pml_bsend_init = 0;
static void* mca_pml_bsend_alloc_segment(
struct mca_mpool_base_module_t* module,
size_t* size_inout,
struct mca_bmi_base_registration_t** registration)
struct mca_mpool_base_registration_t** registration)
{
void *addr;
size_t size = *size_inout;

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

@ -150,7 +150,7 @@ static void mca_pml_ob1_recv_request_ack(
hdr->hdr_match.hdr_common.hdr_flags & MCA_PML_OB1_HDR_FLAGS_PIN) {
struct mca_mpool_base_reg_mpool_t *reg = recvreq->req_chunk->mpools;
while(reg->mpool != NULL) {
if(NULL != mca_pml_ob1_ep_array_find(&proc->bmi_rdma,reg->bmi_module)) {
if(NULL != mca_pml_ob1_ep_array_find(&proc->bmi_rdma,(mca_bmi_base_module_t*) reg->user_data)) {
recvreq->req_rdma_offset = hdr->hdr_frag_length;
ack->hdr_rdma_offset = hdr->hdr_frag_length;
recvreq->req_mpool = reg;
@ -386,7 +386,7 @@ void mca_pml_ob1_recv_request_schedule(mca_pml_ob1_recv_request_t* recvreq)
} else {
/* find the endpoint corresponding to this bmi and schedule the entire message */
ep = mca_pml_ob1_ep_array_find(&proc->bmi_rdma, recvreq->req_mpool->bmi_module);
ep = mca_pml_ob1_ep_array_find(&proc->bmi_rdma, (mca_bmi_base_module_t*) recvreq->req_mpool->user_data);
size = bytes_remaining;
/* prepare a descriptor for RDMA */
@ -397,7 +397,7 @@ void mca_pml_ob1_recv_request_schedule(mca_pml_ob1_recv_request_t* recvreq)
dst = ep->bmi_prepare_dst(
ep->bmi,
ep->bmi_endpoint,
recvreq->req_mpool->bmi_registration,
recvreq->req_mpool->mpool_registration,
&recvreq->req_recv.req_convertor,
0,
&size);

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

@ -584,7 +584,7 @@ void mca_pml_ob1_send_request_put(
{
mca_pml_ob1_proc_t* proc = sendreq->req_proc;
mca_pml_ob1_endpoint_t* ep = mca_pml_ob1_ep_array_find(&proc->bmi_rdma,bmi);
struct mca_bmi_base_registration_t* reg = NULL;
struct mca_mpool_base_registration_t* reg = NULL;
mca_bmi_base_descriptor_t* des;
mca_pml_ob1_rdma_frag_t* frag;
size_t offset = hdr->hdr_rdma_offset;
@ -612,8 +612,8 @@ void mca_pml_ob1_send_request_put(
if(NULL != sendreq->req_chunk) {
mca_mpool_base_reg_mpool_t* mpool = sendreq->req_chunk->mpools;
while(mpool->mpool != NULL) {
if(mpool->bmi_module == bmi) {
reg = mpool->bmi_registration;
if(mpool->user_data == (void*) bmi) {
reg = mpool->mpool_registration;
break;
}
mpool++;