1
1
This commit was SVN r518.
Этот коммит содержится в:
Jeff Squyres 2004-01-22 00:32:06 +00:00
родитель b95c011d2d
Коммит 3c6dc80ac7
3 изменённых файлов: 28 добавлений и 95 удалений

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

@ -4,6 +4,7 @@
#include "lam_config.h" #include "lam_config.h"
#include "lam/mem/free_lists.h" #include "lam/mem/free_lists.h"
#include "lam/runtime/runtime.h"
#include "lam/util/output.h" #include "lam/util/output.h"
#include "lam/os/numa.h" #include "lam/os/numa.h"
#include "lam/os/lam_system.h" #include "lam/os/lam_system.h"
@ -179,12 +180,7 @@ int lam_free_lists_init_with(
flist->fl_nlists); flist->fl_nlists);
if ( !flist->fl_free_lists ) if ( !flist->fl_free_lists )
{ {
lam_output(0, "Error: Out of memory"); lam_abort(1, "Error: Out of memory");
#if NEED_TO_IMPLEMENT_LAM_EXIT
lam_exit(1);
#else
exit(1);
#endif
} }
/* run constructors */ /* run constructors */
@ -206,12 +202,7 @@ int lam_free_lists_init_with(
} }
if (!flist->fl_free_lists[list]) { if (!flist->fl_free_lists[list]) {
lam_output(0, "Error: Out of memory"); lam_abort(1, "Error: Out of memory");
#if NEED_TO_IMPLEMENT_LAM_EXIT
lam_exit(1);
#else
exit(1);
#endif
} }
STATIC_INIT(flist->fl_free_lists[list], &lam_seg_list_cls); STATIC_INIT(flist->fl_free_lists[list], &lam_seg_list_cls);
@ -231,12 +222,7 @@ int lam_free_lists_init_with(
flist->fl_affinity = (affinity_t *)malloc(sizeof(affinity_t) * flist->fl_affinity = (affinity_t *)malloc(sizeof(affinity_t) *
flist->fl_nlists); flist->fl_nlists);
if ( !flist->fl_affinity ) { if ( !flist->fl_affinity ) {
lam_output(0, "Error: Out of memory"); lam_abort(1, "Error: Out of memory");
#if NEED_TO_IMPLEMENT_LAM_EXIT
lam_exit(1);
#else
exit(1);
#endif
} }
/* copy policies in */ /* copy policies in */
@ -258,13 +244,8 @@ int lam_free_lists_init_with(
{ {
if (lam_free_lists_create_more_elts(flist, pool) != LAM_SUCCESS) if (lam_free_lists_create_more_elts(flist, pool) != LAM_SUCCESS)
{ {
lam_output(0, "Error: Setting up initial private " lam_abort(1, "Error: Setting up initial private "
"free list for %s.\n", flist->fl_description); "free list for %s.\n", flist->fl_description);
#if NEED_TO_IMPLEMENT_LAM_EXIT
lam_exit(1);
#else
exit(1);
#endif
} }
} }
@ -273,13 +254,8 @@ int lam_free_lists_init_with(
else else
{ {
/* only 1 process should be initializing the list */ /* only 1 process should be initializing the list */
lam_output(0, "Error: Setting up initial private free " lam_abort(1, "Error: Setting up initial private free "
"list %d for %s.\n", pool, flist->fl_description); "list %d for %s.\n", pool, flist->fl_description);
#if NEED_TO_IMPLEMENT_LAM_EXIT
lam_exit(1);
#else
exit(1);
#endif
} }
} }

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

@ -2,10 +2,14 @@
* $HEADER$ * $HEADER$
*/ */
#include "lam_config.h"
#include <string.h> #include <string.h>
#include <sys/errno.h> #include <sys/errno.h>
#include <unistd.h> #include <unistd.h>
#include "lam/constants.h" #include "lam/constants.h"
#include "lam/runtime/runtime.h"
#include "lam/mem/mem_pool.h" #include "lam/mem/mem_pool.h"
#include "lam/mem/sharedmem_util.h" #include "lam/mem/sharedmem_util.h"
#include "lam/mem/malloc.h" #include "lam/mem/malloc.h"
@ -131,24 +135,14 @@ int lam_mp_init_with(lam_mem_pool_t *pool, uint64_t pool_size,
retval = mprotect(ptr, page_size, PROT_NONE); retval = mprotect(ptr, page_size, PROT_NONE);
if (retval != 0) if (retval != 0)
{ {
lam_output(0, "Error in red zone 1 mprotect"); lam_abort(1, "Error in red zone 1 mprotect");
#if NEED_TO_IMPLEMENT_LAM_EXIT
lam_exit(1);
#else
exit(1);
#endif
} }
/* end red zone */ /* end red zone */
retval = retval =
mprotect(ptr + page_size + wrk_size, page_size, PROT_NONE); mprotect(ptr + page_size + wrk_size, page_size, PROT_NONE);
if (retval != 0) if (retval != 0)
{ {
lam_output(0, "Error in red zone 2 mprotect"); lam_abort(1, "Error in red zone 2 mprotect");
#if NEED_TO_IMPLEMENT_LAM_EXIT
lam_exit(1);
#else
exit(1);
#endif
} }
/* initialize chunk descriptors */ /* initialize chunk descriptors */
@ -336,27 +330,17 @@ int lam_fmp_init_with(lam_fixed_mpool_t *pool, ssize_t initial_allocation,
LAM_MALLOC(sizeof(lam_memseg_t *)*n_pools); LAM_MALLOC(sizeof(lam_memseg_t *)*n_pools);
if ( !pool->fmp_segments ) if ( !pool->fmp_segments )
{ {
lam_output(0, "Unable to allocate memory for " lam_abort(1, "Unable to allocate memory for "
"pool->fmp_segments, requested %ld bytes, errno %d", "pool->fmp_segments, requested %ld bytes, errno %d",
sizeof(int) * n_pools, errno); sizeof(int) * n_pools, errno);
#if NEED_TO_IMPLEMENT_LAM_EXIT
lam_exit(1);
#else
exit(1);
#endif
} }
bzero(pool->fmp_segments, sizeof(lam_memseg_t *)*n_pools); bzero(pool->fmp_segments, sizeof(lam_memseg_t *)*n_pools);
pool->fmp_n_segs_in_array = (int *) LAM_MALLOC(sizeof(int) * n_pools); pool->fmp_n_segs_in_array = (int *) LAM_MALLOC(sizeof(int) * n_pools);
if ( !pool->fmp_n_segs_in_array ) { if ( !pool->fmp_n_segs_in_array ) {
lam_output(0, "Unable to allocate memory for " lam_abort(1, "Unable to allocate memory for "
"pool->fmp_n_segs_in_array, requested %ld bytes, errno %d", "pool->fmp_n_segs_in_array, requested %ld bytes, errno %d",
sizeof(int) * n_pools, errno); sizeof(int) * n_pools, errno);
#if NEED_TO_IMPLEMENT_LAM_EXIT
lam_exit(1);
#else
exit(1);
#endif
} }
bzero(pool->fmp_n_segs_in_array, sizeof(int) * n_pools); bzero(pool->fmp_n_segs_in_array, sizeof(int) * n_pools);
@ -366,26 +350,16 @@ int lam_fmp_init_with(lam_fixed_mpool_t *pool, ssize_t initial_allocation,
ptr = lam_zero_alloc(initial_allocation, MMAP_SHARED_PROT, ptr = lam_zero_alloc(initial_allocation, MMAP_SHARED_PROT,
MMAP_SHARED_FLAGS); MMAP_SHARED_FLAGS);
if ( !ptr ) { if ( !ptr ) {
lam_output(0, "Unable to allocate " lam_abort(1, "Unable to allocate "
"memory pool , requested %ld, errno %d", "memory pool , requested %ld, errno %d",
initial_allocation, errno); initial_allocation, errno);
#if NEED_TO_IMPLEMENT_LAM_EXIT
lam_exit(1);
#else
exit(1);
#endif
} }
if ( apply_mem_affinity ) if ( apply_mem_affinity )
{ {
if (!lam_set_affinity(ptr, initial_allocation, pool_idx)) if (!lam_set_affinity(ptr, initial_allocation, pool_idx))
{ {
lam_output(0, "Error: setting memory affinity"); lam_abort(1, "Error: setting memory affinity");
#if NEED_TO_IMPLEMENT_LAM_EXIT
lam_exit(1);
#else
exit(1);
#endif
} }
} }
@ -475,14 +449,8 @@ void *lam_fmp_get_mem_segment(lam_fixed_mpool_t *pool,
(pool->fmp_n_segments[which_pool] + (pool->fmp_n_segments[which_pool] +
pool->fmp_n_elts_to_add)); pool->fmp_n_elts_to_add));
if ( !tmp_seg ) { if ( !tmp_seg ) {
lam_output(0, "Unable to " lam_abort(1, "Unable to allocate memory for tmp_seg, errno %d",
"allocate memory for tmp_seg, errno %d", errno);
errno);
#if NEED_TO_IMPLEMENT_LAM_EXIT
lam_exit(1);
#else
exit(1);
#endif
} }
/* copy old version of pool->fmp_segments to tmp copy */ /* copy old version of pool->fmp_segments to tmp copy */
for (seg_idx = 0; seg_idx < pool->fmp_n_segments[which_pool]; seg_idx++) for (seg_idx = 0; seg_idx < pool->fmp_n_segments[which_pool]; seg_idx++)
@ -515,23 +483,13 @@ void *lam_fmp_get_mem_segment(lam_fixed_mpool_t *pool,
lam_zero_alloc(len_to_alloc, MMAP_SHARED_PROT, MMAP_SHARED_FLAGS); lam_zero_alloc(len_to_alloc, MMAP_SHARED_PROT, MMAP_SHARED_FLAGS);
if ( !tmp_ptr ) if ( !tmp_ptr )
{ {
lam_output(0, "Unable to allocate memory pool"); lam_abort(1, "Unable to allocate memory pool");
#if NEED_TO_IMPLEMENT_LAM_EXIT
lam_exit(1);
#else
exit(1);
#endif
} }
if ( pool->fmp_apply_affinity ) if ( pool->fmp_apply_affinity )
{ {
if ( !lam_set_affinity(tmp_ptr, len_to_alloc, which_pool) ) { if ( !lam_set_affinity(tmp_ptr, len_to_alloc, which_pool) ) {
lam_output(0, "Error: setting memory affinity"); lam_abort(1, "Error: setting memory affinity");
#if NEED_TO_IMPLEMENT_LAM_EXIT
lam_exit(1);
#else
exit(1);
#endif
} }
} }

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

@ -26,7 +26,6 @@
* Private data * Private data
*/ */
static int verbose_stream = -1; static int verbose_stream = -1;
static int verbose_level = 0;
static lam_output_stream_t verbose = { static lam_output_stream_t verbose = {
/* debugging */ /* debugging */
false, false,