From 72575d81d216a4f38b0b5682cff7d389f51adbea Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Thu, 27 Jul 2006 14:09:30 +0000 Subject: [PATCH] Create separate pool for control messages. It is unlimited, but the maximum number of element that are allocated from it is limited by number of connections. This commit was SVN r11028. --- ompi/mca/btl/openib/btl_openib.h | 1 + ompi/mca/btl/openib/btl_openib_component.c | 16 ++++++++++++++++ ompi/mca/btl/openib/btl_openib_endpoint.c | 12 ++++++------ ompi/mca/btl/openib/btl_openib_frag.c | 11 +++++++++++ ompi/mca/btl/openib/btl_openib_frag.h | 17 +++++++++++++---- 5 files changed, 47 insertions(+), 10 deletions(-) diff --git a/ompi/mca/btl/openib/btl_openib.h b/ompi/mca/btl/openib/btl_openib.h index 320e9a76e1..1b2232a088 100644 --- a/ompi/mca/btl/openib/btl_openib.h +++ b/ompi/mca/btl/openib/btl_openib.h @@ -163,6 +163,7 @@ struct mca_btl_openib_module_t { ompi_free_list_t recv_free_eager; /**< High priority free list of buffer descriptors */ ompi_free_list_t recv_free_max; /**< Low priority free list of buffer descriptors */ + ompi_free_list_t send_free_control; /**< frags for control massages */ opal_mutex_t ib_lock; /**< module level lock */ diff --git a/ompi/mca/btl/openib/btl_openib_component.c b/ompi/mca/btl/openib/btl_openib_component.c index a5a489513b..9edfbee4f5 100644 --- a/ompi/mca/btl/openib/btl_openib_component.c +++ b/ompi/mca/btl/openib/btl_openib_component.c @@ -596,6 +596,7 @@ mca_btl_base_module_t** mca_btl_openib_component_init(int *num_btl_modules, OBJ_CONSTRUCT(&openib_btl->send_free_eager, ompi_free_list_t); OBJ_CONSTRUCT(&openib_btl->send_free_max, ompi_free_list_t); OBJ_CONSTRUCT(&openib_btl->send_free_frag, ompi_free_list_t); + OBJ_CONSTRUCT(&openib_btl->send_free_control, ompi_free_list_t); OBJ_CONSTRUCT(&openib_btl->recv_free_eager, ompi_free_list_t); OBJ_CONSTRUCT(&openib_btl->recv_free_max, ompi_free_list_t); @@ -665,6 +666,21 @@ mca_btl_base_module_t** mca_btl_openib_component_init(int *num_btl_modules, mca_btl_openib_component.ib_free_list_max, mca_btl_openib_component.ib_free_list_inc, openib_btl->super.btl_mpool); + length = sizeof(mca_btl_openib_frag_t) + + sizeof(mca_btl_openib_header_t) + + sizeof(mca_btl_openib_footer_t) + + sizeof(mca_btl_openib_eager_rdma_header_t); + + ompi_free_list_init_ex(&openib_btl->send_free_control, + length, + sizeof(mca_btl_openib_frag_t), + mca_btl_openib_component.buffer_alignment, + OBJ_CLASS(mca_btl_openib_send_frag_control_t), + mca_btl_openib_component.ib_free_list_num, + -1, + mca_btl_openib_component.ib_free_list_inc, + openib_btl->super.btl_mpool); + length = sizeof(mca_btl_openib_frag_t); ompi_free_list_init(&openib_btl->send_free_frag, diff --git a/ompi/mca/btl/openib/btl_openib_endpoint.c b/ompi/mca/btl/openib/btl_openib_endpoint.c index 523cf6ba44..68676a0b1d 100644 --- a/ompi/mca/btl/openib/btl_openib_endpoint.c +++ b/ompi/mca/btl/openib/btl_openib_endpoint.c @@ -179,7 +179,7 @@ static inline int mca_btl_openib_endpoint_post_send(mca_btl_openib_module_t* ope openib_btl->eager_rdma_frag_size + sizeof(mca_btl_openib_frag_t) + sizeof(mca_btl_openib_header_t) + - frag->size + + mca_btl_openib_component.eager_limit + sizeof(mca_btl_openib_footer_t); frag->wr_desc.sr_desc.wr.rdma.remote_addr -= frag->sg_entry.length; MCA_BTL_OPENIB_RDMA_NEXT_INDEX (endpoint->eager_rdma_remote.head); @@ -885,8 +885,8 @@ int mca_btl_openib_endpoint_connect( return rc; } - MCA_BTL_IB_FRAG_ALLOC_EAGER_WAIT(openib_btl, endpoint->hp_credit_frag, rc); - MCA_BTL_IB_FRAG_ALLOC_EAGER_WAIT(openib_btl, endpoint->lp_credit_frag, rc); + MCA_BTL_IB_FRAG_ALLOC_CREDIT_WAIT(openib_btl, endpoint->hp_credit_frag, rc); + MCA_BTL_IB_FRAG_ALLOC_CREDIT_WAIT(openib_btl, endpoint->lp_credit_frag, rc); #ifdef OMPI_MCA_BTL_OPENIB_HAVE_SRQ if(mca_btl_openib_component.use_srq) { @@ -1183,8 +1183,8 @@ static void mca_btl_openib_endpoint_eager_rdma( struct mca_btl_base_descriptor_t* descriptor, int status) { - MCA_BTL_IB_FRAG_RETURN(((mca_btl_openib_module_t*)btl), - ((mca_btl_openib_frag_t*)descriptor)); + MCA_BTL_IB_FRAG_RETURN(((mca_btl_openib_module_t*)btl), + ((mca_btl_openib_frag_t*)descriptor)); } static int mca_btl_openib_endpoint_send_eager_rdma( @@ -1195,7 +1195,7 @@ static int mca_btl_openib_endpoint_send_eager_rdma( mca_btl_openib_frag_t* frag; int rc; - MCA_BTL_IB_FRAG_ALLOC_EAGER(openib_btl, frag, rc); + MCA_BTL_IB_FRAG_ALLOC_CREDIT_WAIT(openib_btl, frag, rc); if(NULL == frag) { return -1; } diff --git a/ompi/mca/btl/openib/btl_openib_frag.c b/ompi/mca/btl/openib/btl_openib_frag.c index d19b29b558..1c0c6d6d4f 100644 --- a/ompi/mca/btl/openib/btl_openib_frag.c +++ b/ompi/mca/btl/openib/btl_openib_frag.c @@ -114,6 +114,12 @@ static void mca_btl_openib_send_frag_frag_constructor(mca_btl_openib_frag_t* fra mca_btl_openib_send_frag_common_constructor(frag); } +static void mca_btl_openib_send_frag_control_constructor(mca_btl_openib_frag_t* frag) +{ + frag->size = sizeof(mca_btl_openib_eager_rdma_header_t); + frag->type = MCA_BTL_OPENIB_FRAG_CONTROL; + mca_btl_openib_send_frag_common_constructor(frag); +} OBJ_CLASS_INSTANCE( mca_btl_openib_frag_t, @@ -153,4 +159,9 @@ OBJ_CLASS_INSTANCE( mca_btl_openib_recv_frag_max_constructor, NULL); +OBJ_CLASS_INSTANCE( + mca_btl_openib_send_frag_control_t, + mca_btl_base_descriptor_t, + mca_btl_openib_send_frag_control_constructor, + NULL); diff --git a/ompi/mca/btl/openib/btl_openib_frag.h b/ompi/mca/btl/openib/btl_openib_frag.h index b5f3411bf3..01802eb3c1 100644 --- a/ompi/mca/btl/openib/btl_openib_frag.h +++ b/ompi/mca/btl/openib/btl_openib_frag.h @@ -69,7 +69,8 @@ enum mca_btl_openib_frag_type_t { MCA_BTL_OPENIB_FRAG_EAGER, MCA_BTL_OPENIB_FRAG_MAX, MCA_BTL_OPENIB_FRAG_FRAG, - MCA_BTL_OPENIB_FRAG_EAGER_RDMA + MCA_BTL_OPENIB_FRAG_EAGER_RDMA, + MCA_BTL_OPENIB_FRAG_CONTROL }; typedef enum mca_btl_openib_frag_type_t mca_btl_openib_frag_type_t; @@ -117,6 +118,10 @@ typedef struct mca_btl_openib_frag_t mca_btl_openib_recv_frag_max_t; OBJ_CLASS_DECLARATION(mca_btl_openib_recv_frag_max_t); +typedef struct mca_btl_openib_frag_t mca_btl_openib_send_frag_control_t; + +OBJ_CLASS_DECLARATION(mca_btl_openib_send_frag_control_t); + @@ -125,11 +130,11 @@ OBJ_CLASS_DECLARATION(mca_btl_openib_recv_frag_max_t); * */ -#define MCA_BTL_IB_FRAG_ALLOC_EAGER_WAIT(btl, frag, rc) \ +#define MCA_BTL_IB_FRAG_ALLOC_CREDIT_WAIT(btl, frag, rc) \ { \ \ ompi_free_list_item_t *item; \ - OMPI_FREE_LIST_WAIT(&((mca_btl_openib_module_t*)btl)->send_free_eager, item, rc); \ + OMPI_FREE_LIST_WAIT(&((mca_btl_openib_module_t*)btl)->send_free_control, item, rc); \ frag = (mca_btl_openib_frag_t*) item; \ } @@ -168,10 +173,14 @@ OBJ_CLASS_DECLARATION(mca_btl_openib_recv_frag_max_t); case MCA_BTL_OPENIB_FRAG_MAX: \ my_list = &btl->send_free_max; \ break; \ + case MCA_BTL_OPENIB_FRAG_CONTROL: \ + my_list = &btl->send_free_control; \ + break; \ case MCA_BTL_OPENIB_FRAG_FRAG: \ my_list = &btl->send_free_frag; \ + break; \ } \ - OMPI_FREE_LIST_RETURN(my_list, (ompi_free_list_item_t*)(frag)); \ + OMPI_FREE_LIST_RETURN(my_list, (ompi_free_list_item_t*)(frag)); \ } while(0); \ }