1
1

modify rcache_rb to find registrations in the middle of a base and bound

This commit was SVN r7528.
Этот коммит содержится в:
Galen Shipman 2005-09-28 02:11:35 +00:00
родитель 676e34c2d4
Коммит b9b78f8f5d
3 изменённых файлов: 28 добавлений и 12 удалений

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

@ -91,8 +91,8 @@ size_t mca_pml_ob1_rdma_btls(
/* otherwise if leave_pinned re-register */
} else if(mca_pml_ob1.leave_pinned) {
unsigned char* new_base = reg->base;
size_t new_len = (base - reg->base) + size;
unsigned char* new_base = reg->base < base ? reg->base : base;
size_t new_len = (base - new_base) + size;
/* printf("re-reg 2: base %p size %d new_base %p new_len %d\n", base, size, new_base, new_len); */
assert(new_len >= size);
btl_mpool->mpool_deregister(btl_mpool, reg);
@ -255,8 +255,8 @@ mca_mpool_base_registration_t* mca_pml_ob1_rdma_registration(
assert(fit->ref_count >= 3);
/* a registration exists but is not large enough */
} else {
unsigned char* new_base = largest->base;
size_t new_len = (base - largest->base) + size;
unsigned char* new_base = largest->base < base ? largest->base: base;
size_t new_len = (base - new_base) + size;
/* printf("re-reg 2: base %p size %d new_base %p new_len %d\n", base, size, new_base, new_len); */
btl_mpool->mpool_deregister(btl_mpool, largest);

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

@ -19,6 +19,10 @@
#include "rcache_rb_tree.h"
#include "rcache_rb_mru.h"
#include "opal/util/output.h"
#include "ompi/mca/mpool/base/base.h"
extern unsigned int mca_mpool_base_page_size;
extern unsigned int mca_mpool_base_page_size_log;
/**
* Initialize the rcache
@ -44,14 +48,31 @@ int mca_rcache_rb_find (
int pos, rc = OMPI_SUCCESS;
mca_rcache_rb_tree_item_t* tree_item;
void* base_addr;
void* bound_addr;
if(size == 0) {
return OMPI_ERROR;
}
OPAL_THREAD_LOCK(&rcache->lock);
*cnt = 0;
tree_item = mca_rcache_rb_tree_find( (mca_rcache_rb_module_t*) rcache, addr );
base_addr = down_align_addr(addr, mca_mpool_base_page_size_log);
bound_addr = up_align_addr((void*) ((unsigned long) addr + size - 1), mca_mpool_base_page_size_log);
for( ; base_addr <= bound_addr;
base_addr =(void*) ((unsigned long) base_addr + mca_mpool_base_page_size)) {
tree_item = mca_rcache_rb_tree_find( (mca_rcache_rb_module_t*) rcache, base_addr );
if(NULL != tree_item) {
break;
}
}
if(NULL == tree_item) {
OPAL_THREAD_UNLOCK(&rcache->lock);
return OMPI_ERROR;
}
OBJ_DESTRUCT(regs);
OBJ_CONSTRUCT(regs, ompi_pointer_array_t);
@ -76,7 +97,6 @@ int mca_rcache_rb_find (
*cnt = 1;
}
assert(tree_item->reg->bound - tree_item->reg->base >= 0);
assert(((void*) tree_item->reg->base) <= addr);
assert(((void*) tree_item->reg->bound) >= addr);
return rc;
}

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

@ -58,13 +58,9 @@ struct mca_rcache_rb_tree_item_t * mca_rcache_rb_tree_find(
key.bound = base;
found = (mca_rcache_rb_tree_item_t *)
ompi_rb_tree_find(&rcache->rb_tree, &key);
if(found)
assert((void*)found->reg->bound >= base);
if(NULL != found ) {
if((void*) found->reg->base > base ||
(void*) found->reg->bound < base){
assert(0);
}
}
return found;
}