2005-09-14 13:27:09 +00:00
|
|
|
/*
|
2005-11-05 19:57:48 +00:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-08-24 16:38:08 +00:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 19:57:48 +00:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-09-14 13:27:09 +00:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
2006-08-24 16:38:08 +00:00
|
|
|
#include "ompi_config.h"
|
2006-12-17 12:26:41 +00:00
|
|
|
#include "opal/util/output.h"
|
2005-09-14 13:27:09 +00:00
|
|
|
#include "mpool_base_mem_cb.h"
|
|
|
|
#include "base.h"
|
2005-10-03 23:29:26 +00:00
|
|
|
#include "orte/util/proc_info.h"
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "orte/mca/ns/ns_types.h"
|
2005-09-14 13:27:09 +00:00
|
|
|
|
2005-09-27 02:01:21 +00:00
|
|
|
|
|
|
|
extern uint32_t mca_mpool_base_page_size;
|
|
|
|
extern uint32_t mca_mpool_base_page_size_log;
|
2006-02-08 22:40:40 +00:00
|
|
|
ompi_pointer_array_t mca_mpool_base_mem_cb_array;
|
2005-09-27 02:01:21 +00:00
|
|
|
|
2005-09-14 13:27:09 +00:00
|
|
|
/*
|
|
|
|
* memory hook callback, called when memory is free'd out from under us
|
|
|
|
*/
|
2005-12-16 01:12:45 +00:00
|
|
|
void mca_mpool_base_mem_cb(void* base, size_t size, void* cbdata,
|
|
|
|
bool from_alloc)
|
2005-09-22 16:18:23 +00:00
|
|
|
{
|
2005-09-14 13:27:09 +00:00
|
|
|
mca_mpool_base_selected_module_t* current;
|
|
|
|
int rc;
|
|
|
|
opal_list_item_t* item;
|
2005-09-27 18:10:44 +00:00
|
|
|
if(size == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-09-14 13:27:09 +00:00
|
|
|
for(item = opal_list_get_first(&mca_mpool_base_modules);
|
|
|
|
item != opal_list_get_end(&mca_mpool_base_modules);
|
|
|
|
item = opal_list_get_next(item)) {
|
2006-12-17 12:26:41 +00:00
|
|
|
bool warn = true;
|
2005-09-14 13:27:09 +00:00
|
|
|
|
|
|
|
current = (mca_mpool_base_selected_module_t*) item;
|
2006-12-17 12:26:41 +00:00
|
|
|
|
|
|
|
if(current->mpool_module->mpool_release_memory != NULL) {
|
|
|
|
rc = current->mpool_module->mpool_release_memory(current->mpool_module,
|
|
|
|
base, size);
|
|
|
|
|
|
|
|
if(rc != OMPI_SUCCESS && true == warn) {
|
2007-02-01 19:27:11 +00:00
|
|
|
opal_output(0, "Memory %p:%lu cannot be freed from the "
|
2006-12-17 12:26:41 +00:00
|
|
|
"registration cache. Possible memory corruption.\n",
|
2007-02-01 19:27:11 +00:00
|
|
|
base, (unsigned long)size);
|
2006-12-17 12:26:41 +00:00
|
|
|
warn = false;
|
2005-09-14 13:27:09 +00:00
|
|
|
}
|
2005-09-27 02:01:21 +00:00
|
|
|
}
|
2005-10-03 23:29:26 +00:00
|
|
|
}
|
2005-09-14 13:27:09 +00:00
|
|
|
}
|