1
1

mpool/grdma: temporarily remove support for remote (local) process eviction and remove ignore.

This commit was SVN r26621.
Этот коммит содержится в:
Nathan Hjelm 2012-06-20 23:00:25 +00:00
родитель 019857b616
Коммит f5fd87a446
5 изменённых файлов: 13 добавлений и 113 удалений

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

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

@ -1 +0,0 @@
hjelmn

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

@ -39,13 +39,10 @@ BEGIN_C_DECLS
struct mca_mpool_grdma_pool_t {
opal_list_item_t super;
char pool_name[MCA_MPOOL_GRDMA_NAME_MAX];
char *pool_name;
opal_list_t lru_list;
opal_list_t gc_list;
int shm_fd;
char *shm_filename;
volatile int64_t *flagp;
bool skip;
struct mca_rcache_base_module_t *rcache;
};
typedef struct mca_mpool_grdma_pool_t mca_mpool_grdma_pool_t;
@ -66,7 +63,7 @@ OMPI_DECLSPEC extern mca_mpool_grdma_component_t mca_mpool_grdma_component;
struct mca_mpool_grdma_module_t;
struct mca_mpool_base_resources_t {
char pool_name[MCA_MPOOL_GRDMA_NAME_MAX];
char *pool_name;
void *reg_data;
size_t sizeof_reg;
int (*register_mem)(void *reg_data, void *base, size_t size,
@ -153,8 +150,6 @@ void mca_mpool_grdma_finalize(struct mca_mpool_base_module_t *mpool);
*/
int mca_mpool_grdma_ft_event(int state);
int mca_mpool_grdma_progress (void);
/**
* evict one unused registration from the mpool's lru.
* @return true on success, false on failure

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

@ -150,38 +150,15 @@ grdma_init(struct mca_mpool_base_resources_t *resources)
}
if (NULL == pool) {
/* create new pool */
pool = OBJ_NEW(mca_mpool_grdma_pool_t);
if (NULL == pool) {
return NULL;
}
do {
if(asprintf(&pool->shm_filename, "/grdma.%s", resources->pool_name) < 0) {
break;
}
pool->pool_name = strdup (resources->pool_name);
pool->shm_fd = shm_open (pool->shm_filename, O_CREAT | O_RDWR | O_EXCL, 0600);
if (0 > pool->shm_fd) {
pool->shm_fd = shm_open (pool->shm_filename, O_RDWR, 0600);
}
if (0 > pool->shm_fd) {
break;
}
ftruncate (pool->shm_fd, 16);
pool->flagp = mmap (NULL, 16, PROT_READ | PROT_WRITE, MAP_SHARED, pool->shm_fd, 0);
pool->flagp[0] = 0;
pool->flagp[1] = 0;
strcpy (pool->pool_name, resources->pool_name);
opal_list_append (&mca_mpool_grdma_component.pools, &pool->super);
if (1 == opal_list_get_size (&mca_mpool_grdma_component.pools)) {
opal_progress_register (mca_mpool_grdma_progress);
}
} while (0);
opal_list_append (&mca_mpool_grdma_component.pools, &pool->super);
}
mpool_module =

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

@ -46,26 +46,16 @@ static void mca_mpool_grdma_pool_contructor (mca_mpool_grdma_pool_t *pool)
OBJ_CONSTRUCT(&pool->lru_list, opal_list_t);
OBJ_CONSTRUCT(&pool->gc_list, opal_list_t);
pool->rcache = mca_rcache_base_module_create(mca_mpool_grdma_component.rcache_name);
}
static void mca_mpool_grdma_pool_destructor (mca_mpool_grdma_pool_t *pool)
{
if (pool->flagp) {
opal_progress_unregister (mca_mpool_grdma_progress);
munmap ((void *) pool->flagp, 4096);
}
if (0 <= pool->shm_fd) {
close (pool->shm_fd);
shm_unlink (pool->shm_filename);
}
if (pool->shm_filename) {
free (pool->shm_filename);
}
OBJ_DESTRUCT(&pool->lru_list);
OBJ_DESTRUCT(&pool->gc_list);
free (pool->pool_name);
}
OBJ_CLASS_INSTANCE(mca_mpool_grdma_pool_t, opal_list_item_t,
@ -92,8 +82,7 @@ void mca_mpool_grdma_module_init(mca_mpool_grdma_module_t* mpool, mca_mpool_grdm
mpool->super.mpool_finalize = mca_mpool_grdma_finalize;
mpool->super.mpool_ft_event = mca_mpool_grdma_ft_event;
mpool->super.flags = MCA_MPOOL_FLAGS_MPI_ALLOC_MEM;
mpool->super.rcache =
mca_rcache_base_module_create(mca_mpool_grdma_component.rcache_name);
mpool->super.rcache = pool->rcache;
mpool->stat_cache_hit = mpool->stat_cache_miss = mpool->stat_evicted = 0;
mpool->stat_cache_found = mpool->stat_cache_notfound = 0;
@ -210,67 +199,7 @@ enum {
bool mca_mpool_grdma_evict (struct mca_mpool_base_module_t *mpool)
{
mca_mpool_grdma_module_t *mpool_grdma = (mca_mpool_grdma_module_t*)mpool;
mca_mpool_grdma_pool_t *pool = mpool_grdma->pool;
/* give up after awhile */
struct timespec timeout = {0, 1000};
int tries = 50;
/* try evicting from the local lru first */
if (OPAL_LIKELY(mca_mpool_grdma_evict_lru_local (pool))) {
return true;
} else if (NULL == pool->flagp) {
return false;
}
opal_atomic_rmb ();
while (!opal_atomic_cmpset_64 (pool->flagp, MCA_MPOOL_GRDMA_MSG_EMPTY,
MCA_MPOOL_GRDMA_MSG_NEED_DEREG) && --tries) {
nanosleep (&timeout, NULL);
opal_atomic_rmb ();
} /* line is busy. wait until the flag is set to MCA_MPOOL_GRDMA_MSG_EMPTY */
if (!tries) {
return false;
}
opal_atomic_wmb ();
/* wait for a responder to set the flag back to MCA_MPOOL_GRDMA_MSG_COMPLETE or
we time out */
while (MCA_MPOOL_GRDMA_MSG_COMPLETE != pool->flagp[0] && --tries) {
nanosleep (&timeout, NULL);
opal_atomic_rmb ();
}
opal_atomic_wmb ();
return !!(tries);
}
int mca_mpool_grdma_progress (void)
{
opal_list_item_t *item;
for (item = opal_list_get_first (&mca_mpool_grdma_component.pools) ;
item != opal_list_get_end (&mca_mpool_grdma_component.pools) ;
item = opal_list_get_next (item)) {
mca_mpool_grdma_pool_t *pool = (mca_mpool_grdma_pool_t *) item;
/* nothing to do */
if (10 > opal_list_get_size (&pool->lru_list)) {
continue;
}
opal_atomic_rmb ();
if (opal_atomic_cmpset_64 (pool->flagp, MCA_MPOOL_GRDMA_MSG_NEED_DEREG,
MCA_MPOOL_GRDMA_MSG_BUSY)) {
(void) mca_mpool_grdma_evict_lru_local (pool);
pool->flagp[0] = MCA_MPOOL_GRDMA_MSG_COMPLETE;
opal_atomic_wmb ();
}
}
return 0;
return mca_mpool_grdma_evict_lru_local (((mca_mpool_grdma_module_t *) mpool)->pool);
}
/*
@ -490,7 +419,7 @@ int mca_mpool_grdma_release_memory(struct mca_mpool_base_module_t *mpool,
OPAL_THREAD_LOCK(&mpool->rcache->lock);
do {
reg_cnt = mpool->rcache->rcache_find_all(mpool->rcache, base, size,
regs, GRDMA_MPOOL_NREGS);
regs, GRDMA_MPOOL_NREGS);
for(i = 0 ; i < reg_cnt ; ++i) {
regs[i]->flags |= MCA_MPOOL_FLAGS_INVALID;