From fe87e28feede2abf8607c40801beaba838778f59 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Mon, 15 Dec 2008 03:45:34 +0000 Subject: [PATCH] This is a temporary fix for the deadlock problem over MX. The real problem seems to come from the free list, but due to lack of time to understand it completely, I provide this fix. Basically, there is no waiting in the MX BTL anymore, if we cannot allocate a fragment we rely on the PML to take the corrective actions. This commit was SVN r20124. --- ompi/mca/btl/mx/btl_mx_frag.h | 43 +++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/ompi/mca/btl/mx/btl_mx_frag.h b/ompi/mca/btl/mx/btl_mx_frag.h index e9c84070bb..6a17b194eb 100644 --- a/ompi/mca/btl/mx/btl_mx_frag.h +++ b/ompi/mca/btl/mx/btl_mx_frag.h @@ -62,27 +62,32 @@ OBJ_CLASS_DECLARATION(mca_btl_mx_frag_user_t); * free list(s). */ -#define MCA_BTL_MX_FRAG_ALLOC_EAGER(btl, frag, rc) \ - { \ - ompi_free_list_item_t *item; \ - OMPI_FREE_LIST_WAIT( &mca_btl_mx_component.mx_send_eager_frags, item, rc); \ - frag = (mca_btl_mx_frag_t*) item; \ - frag->mx_frag_list = &(mca_btl_mx_component.mx_send_eager_frags); \ - frag->segment[0].seg_addr.pval = (void*)(frag+1); \ - } +#define MCA_BTL_MX_FRAG_ALLOC_EAGER(btl, frag, rc) \ +do { \ + ompi_free_list_item_t *item; \ + OMPI_FREE_LIST_GET( &mca_btl_mx_component.mx_send_eager_frags, item, rc); \ + if( OPAL_LIKELY(NULL != item) ) { \ + frag = (mca_btl_mx_frag_t*) item; \ + frag->mx_frag_list = &(mca_btl_mx_component.mx_send_eager_frags); \ + frag->segment[0].seg_addr.pval = (void*)(frag+1); \ + } \ +} while(0) -#define MCA_BTL_MX_FRAG_ALLOC_USER(btl, frag, rc) \ - { \ - ompi_free_list_item_t *item; \ - OMPI_FREE_LIST_WAIT( &mca_btl_mx_component.mx_send_user_frags, item, rc); \ - frag = (mca_btl_mx_frag_t*) item; \ - frag->mx_frag_list = &(mca_btl_mx_component.mx_send_user_frags); \ - } +#define MCA_BTL_MX_FRAG_ALLOC_USER(btl, frag, rc) \ +do { \ + ompi_free_list_item_t *item; \ + OMPI_FREE_LIST_GET( &mca_btl_mx_component.mx_send_user_frags, item, rc); \ + if( OPAL_LIKELY(NULL != item) ) { \ + frag = (mca_btl_mx_frag_t*) item; \ + frag->mx_frag_list = &(mca_btl_mx_component.mx_send_user_frags); \ + } \ +} while(0) -#define MCA_BTL_MX_FRAG_RETURN(btl, frag) \ - { \ - OMPI_FREE_LIST_RETURN( frag->mx_frag_list, (ompi_free_list_item_t*)(frag)); \ - } +#define MCA_BTL_MX_FRAG_RETURN(btl, frag) \ +do { \ + OMPI_FREE_LIST_RETURN( frag->mx_frag_list, \ + (ompi_free_list_item_t*)(frag)); \ +} while(0) END_C_DECLS