diff --git a/ompi/mca/btl/openib/btl_openib_endpoint.c b/ompi/mca/btl/openib/btl_openib_endpoint.c index a39f09c6fd..d9cb6760a0 100644 --- a/ompi/mca/btl/openib/btl_openib_endpoint.c +++ b/ompi/mca/btl/openib/btl_openib_endpoint.c @@ -506,7 +506,7 @@ int mca_btl_openib_endpoint_post_recvs(mca_btl_openib_endpoint_t *endpoint) for (qp = 0; qp < mca_btl_openib_component.num_qps; ++qp) { if (BTL_OPENIB_QP_TYPE_PP(qp)) { - mca_btl_openib_endpoint_post_rr(endpoint, qp); + mca_btl_openib_endpoint_post_rr_nolock(endpoint, qp); } else { mca_btl_openib_post_srr(endpoint->endpoint_btl, qp); } diff --git a/ompi/mca/btl/openib/btl_openib_endpoint.h b/ompi/mca/btl/openib/btl_openib_endpoint.h index 7dd0f202a0..7829aa7113 100644 --- a/ompi/mca/btl/openib/btl_openib_endpoint.h +++ b/ompi/mca/btl/openib/btl_openib_endpoint.h @@ -267,7 +267,7 @@ static inline int post_recvs(mca_btl_base_endpoint_t *ep, const int qp, return OMPI_ERROR; } -static inline int mca_btl_openib_endpoint_post_rr( +static inline int mca_btl_openib_endpoint_post_rr_nolock( mca_btl_base_endpoint_t *ep, const int qp) { int rd_rsv = mca_btl_openib_component.qp_infos[qp].u.pp_qp.rd_rsv; @@ -278,8 +278,6 @@ static inline int mca_btl_openib_endpoint_post_rr( assert(BTL_OPENIB_QP_TYPE_PP(qp)); - OPAL_THREAD_LOCK(&ep->endpoint_lock); - if(ep->qps[qp].u.pp_qp.rd_posted <= rd_low) num_post = rd_num - ep->qps[qp].u.pp_qp.rd_posted; @@ -306,10 +304,19 @@ static inline int mca_btl_openib_endpoint_post_rr( assert(ep->qps[qp].u.pp_qp.rd_credits <= rd_num && ep->qps[qp].u.pp_qp.rd_credits >= 0); - OPAL_THREAD_UNLOCK(&ep->endpoint_lock); return OMPI_SUCCESS; } +static inline int mca_btl_openib_endpoint_post_rr( + mca_btl_base_endpoint_t *ep, const int qp) +{ + int ret; + OPAL_THREAD_LOCK(&ep->endpoint_lock); + ret = mca_btl_openib_endpoint_post_rr_nolock(ep, qp); + OPAL_THREAD_UNLOCK(&ep->endpoint_lock); + return ret; +} + #define BTL_OPENIB_CREDITS_SEND_TRYLOCK(E, Q) \ OPAL_ATOMIC_CMPSET_32(&(E)->qps[(Q)].rd_credit_send_lock, 0, 1) #define BTL_OPENIB_CREDITS_SEND_UNLOCK(E, Q) \