1
1

- In rb/rcache_rb.c, the reg->flags should only be operated under the

lock -- therefore move the OPAL_THREAD_UNLOCK after
   the if-OMPI_ERR_TEMP_OUT_OF_RESOURCE block.

 - As mca_rcache_rb_mru_delete is the only setter of rc, move the
   error-check right after mca_rcache_rb_mru_delete.

 - Removed a few nitty ompi/info/info.h and orte/util/show_help.h

This commit was SVN r20355.
Этот коммит содержится в:
Rainer Keller 2009-01-27 19:00:03 +00:00
родитель de4c123ca2
Коммит 9825e087b8
4 изменённых файлов: 26 добавлений и 28 удалений

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

@ -22,7 +22,6 @@
#include "rcache_rb.h"
#include "rcache_rb_tree.h"
#include "rcache_rb_mru.h"
#include "orte/util/show_help.h"
#include "ompi/mca/mpool/base/base.h"
/**
@ -63,8 +62,7 @@ int mca_rcache_rb_find( struct mca_rcache_base_module_t* rcache,
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);
while(base_addr <= bound_addr) {
tree_item = mca_rcache_rb_tree_find( (mca_rcache_rb_module_t*) rcache, base_addr );
if(NULL != tree_item) {
@ -87,8 +85,7 @@ int mca_rcache_rb_find( struct mca_rcache_base_module_t* rcache,
base_addr =(void*) ((unsigned long) base_addr + mca_mpool_base_page_size);
}
}
OPAL_THREAD_UNLOCK(&rcache->lock);
return OMPI_SUCCESS;
}
@ -97,21 +94,25 @@ int mca_rcache_rb_insert (
struct mca_rcache_base_module_t* rcache,
mca_mpool_base_registration_t* reg,
uint32_t flags
) {
int rc = OMPI_SUCCESS;
)
{
int rc;
OPAL_THREAD_LOCK(&rcache->lock);
reg->flags = flags;
if(flags & MCA_MPOOL_FLAGS_CACHE) {
rc = mca_rcache_rb_mru_insert( (mca_rcache_rb_module_t*) rcache, reg);
if(OMPI_SUCCESS != rc) {
OPAL_THREAD_UNLOCK(&rcache->lock);
if(OMPI_ERR_TEMP_OUT_OF_RESOURCE == rc) {
/* if the registration is too big for the rcache,
don't cahce it and reset the flags so the upper level
handles things appropriatly */
/*
* If the registration is too big for the rcache,
* don't cache it and reset the flags so the upper level
* handles things appropriately
*/
reg->flags = 0;
return OMPI_SUCCESS;
rc = OMPI_SUCCESS;
}
OPAL_THREAD_UNLOCK(&rcache->lock);
return rc;
}
OPAL_THREAD_ADD32((int32_t*)&reg->ref_count, 1);
@ -126,24 +127,26 @@ int mca_rcache_rb_delete (
struct mca_rcache_base_module_t* rcache,
mca_mpool_base_registration_t* reg,
uint32_t flags
) {
int rc = OMPI_SUCCESS;
)
{
int rc;
assert(reg->ref_count >= 1);
OPAL_THREAD_LOCK(&rcache->lock);
if(flags & MCA_MPOOL_FLAGS_CACHE) {
assert(reg->ref_count >= 2);
OPAL_THREAD_ADD32((int32_t*)&reg->ref_count, -1);
rc = mca_rcache_rb_mru_delete( (mca_rcache_rb_module_t*) rcache, reg);
}
if(OMPI_SUCCESS != rc) {
OPAL_THREAD_UNLOCK(&rcache->lock);
return rc;
if(OMPI_SUCCESS != rc) {
OPAL_THREAD_UNLOCK(&rcache->lock);
return rc;
}
}
reg->flags = 0;
OPAL_THREAD_ADD32((int32_t*)&reg->ref_count, -1);
rc = mca_rcache_rb_tree_delete((mca_rcache_rb_module_t*)rcache, reg );
OPAL_THREAD_UNLOCK(&rcache->lock);
return rc;
return rc;
}
@ -153,11 +156,7 @@ int mca_rcache_rb_delete (
*/
void mca_rcache_rb_finalize(
struct mca_rcache_base_module_t* rcache
) {
)
{
}

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

@ -25,7 +25,6 @@
#include "ompi/mca/rcache/rcache.h"
#include "rcache_vma.h"
#include "rcache_vma_tree.h"
#include "orte/util/show_help.h"
#include "ompi/mca/mpool/base/base.h"
/**

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

@ -42,7 +42,8 @@ typedef struct mca_rcache_vma_module_t mca_rcache_vma_module_t;
struct mca_rcache_vma_component_t {
mca_rcache_base_component_t super;
}; typedef struct mca_rcache_vma_component_t mca_rcache_vma_component_t;
};
typedef struct mca_rcache_vma_component_t mca_rcache_vma_component_t;
OMPI_DECLSPEC extern mca_rcache_vma_component_t mca_rcache_vma_component;

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

@ -26,7 +26,6 @@
#ifndef MCA_RCACHE_VMA_TREE_H
#define MCA_RCACHE_VMA_TREE_H
#include "opal/mca/mca.h"
#include "ompi/info/info.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/mpool/mpool.h"
#include "rcache_vma.h"