diff --git a/ompi/mca/mpool/base/base.h b/ompi/mca/mpool/base/base.h index 11ab88c788..3e66d46f52 100644 --- a/ompi/mca/mpool/base/base.h +++ b/ompi/mca/mpool/base/base.h @@ -29,6 +29,12 @@ #include "ompi/mca/mpool/mpool.h" #include "opal/threads/mutex.h" +#if defined(HAVE_MALLOPT) && defined(M_TRIM_THRESHOLD) && defined(M_MMAP_MAX) +#define MPOOL_BASE_CAN_DISABLE_SBRK 1 +#else +#define MPOOL_BASE_CAN_DISABLE_SBRK 0 +#endif + #if defined(c_plusplus) || defined(__cplusplus) extern "C" { #endif diff --git a/ompi/mca/mpool/base/mpool_base_lookup.c b/ompi/mca/mpool/base/mpool_base_lookup.c index 56a61a7b0e..1bfadabe9f 100644 --- a/ompi/mca/mpool/base/mpool_base_lookup.c +++ b/ompi/mca/mpool/base/mpool_base_lookup.c @@ -27,10 +27,10 @@ #include "ompi/mca/mpool/base/base.h" #include "mpool_base_mem_cb.h" -#if defined(HAVE_MALLOPT) +#if MPOOL_BASE_CAN_DISABLE_SBRK #include extern int mca_mpool_base_disable_sbrk; -#endif /* defined(HAVE_MALLOPT) */ +#endif /* MPOOL_BASE_CAN_DISABLE_SBRK */ extern int mca_mpool_base_use_mem_hooks; @@ -99,12 +99,12 @@ mca_mpool_base_module_t* mca_mpool_base_module_create( OBJ_CONSTRUCT(&mca_mpool_base_mem_cb_array, ompi_pointer_array_t); } -#if defined(HAVE_MALLOPT) +#if MPOOL_BASE_CAN_DISABLE_SBRK else if(mca_mpool_base_disable_sbrk) { mallopt(M_TRIM_THRESHOLD, -1); mallopt(M_MMAP_MAX, 0); } -#endif /* defined(HAVE_MALLOPT) */ +#endif /* MPOOL_BASE_CAN_DISABLE_SBRK */ } return module; } diff --git a/ompi/mca/mpool/base/mpool_base_open.c b/ompi/mca/mpool/base/mpool_base_open.c index 6237853ba5..b7a01e2d5d 100644 --- a/ompi/mca/mpool/base/mpool_base_open.c +++ b/ompi/mca/mpool/base/mpool_base_open.c @@ -43,7 +43,7 @@ int mca_mpool_base_output = -1; int mca_mpool_base_use_mem_hooks = 0; -#if defined(HAVE_MALLOPT) +#if MPOOL_BASE_CAN_DISABLE_SBRK int mca_mpool_base_disable_sbrk = 0; #endif @@ -63,9 +63,9 @@ int mca_mpool_base_open(void) mca_mpool_base_components list */ int use_mem_hooks; -#if defined(HAVE_MALLOPT) +#if MPOOL_BASE_CAN_DISABLE_SBRK int disable_sbrk; -#endif /* defined(HAVE_MALLOPT) */ +#endif /* MPOOL_BASE_CAN_DISABLE_SBRK */ if (OMPI_SUCCESS != mca_base_components_open("mpool", 0, mca_mpool_base_static_components, @@ -101,7 +101,7 @@ int mca_mpool_base_open(void) mca_mpool_base_use_mem_hooks = use_mem_hooks || mca_mpool_base_use_mem_hooks; -#if defined(HAVE_MALLOPT) +#if MPOOL_BASE_CAN_DISABLE_SBRK mca_base_param_reg_int_name("mpool", "base_disable_sbrk", "use mallopt to override calling sbrk (doesn't return memory to OS!)", @@ -123,7 +123,7 @@ int mca_mpool_base_open(void) #endif /* force mem hooks if leave_pinned or leave_pinned_pipeline is enabled */ -#if defined(HAVE_MALLOPT) +#if MPOOL_BASE_CAN_DISABLE_SBRK if(0 == mca_mpool_base_use_mem_hooks && 0 == mca_mpool_base_disable_sbrk) { #else if(0 == mca_mpool_base_use_mem_hooks ) {