From a5fc2762dda602145ab5c5986f0f87971214fff5 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Thu, 19 May 2005 06:53:57 +0000 Subject: [PATCH] 1. Do not try to get the remote proc if we will not use it 2. Always release the request lock before calling FREE ... This commit was SVN r5753. --- src/mca/pml/uniq/pml_uniq_sendreq.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/mca/pml/uniq/pml_uniq_sendreq.c b/src/mca/pml/uniq/pml_uniq_sendreq.c index b39d9b8b17..85889b493e 100644 --- a/src/mca/pml/uniq/pml_uniq_sendreq.c +++ b/src/mca/pml/uniq/pml_uniq_sendreq.c @@ -80,9 +80,7 @@ OBJ_CLASS_INSTANCE( int mca_pml_uniq_send_request_schedule(mca_ptl_base_send_request_t* req) { - ompi_proc_t *proc = ompi_comm_peer_lookup(req->req_send.req_base.req_comm, req->req_send.req_base.req_peer); - mca_pml_proc_t* proc_pml = proc->proc_pml; - int send_count = 0, rc; + int rc; size_t bytes_remaining; /* @@ -92,6 +90,9 @@ int mca_pml_uniq_send_request_schedule(mca_ptl_base_send_request_t* req) * the scheduling logic once for every call. */ if(OMPI_THREAD_ADD32(&req->req_lock,1) == 1) { + mca_pml_proc_t* proc_pml = mca_pml_uniq_proc_lookup_remote( req->req_send.req_base.req_comm, + req->req_send.req_base.req_peer ); + #if PML_UNIQ_ACCEPT_NEXT_PTL mca_ptl_proc_t* ptl_proc = &(proc_pml->proc_ptl_next); #else @@ -109,24 +110,22 @@ int mca_pml_uniq_send_request_schedule(mca_ptl_base_send_request_t* req) rc = ptl->ptl_put(ptl, ptl_proc->ptl_peer, req, req->req_offset, bytes_remaining, 0); if(rc == OMPI_SUCCESS) { - send_count++; bytes_remaining = req->req_send.req_bytes_packed - req->req_offset; - } - - /* unable to complete send - queue for later */ - if(send_count == 0) { + } else { /* unable to complete send - queue for later */ OMPI_THREAD_LOCK(&mca_pml_uniq.uniq_lock); ompi_list_append(&mca_pml_uniq.uniq_send_pending, (ompi_list_item_t*)req); OMPI_THREAD_UNLOCK(&mca_pml_uniq.uniq_lock); req->req_lock = 0; return OMPI_ERR_OUT_OF_RESOURCE; } - + OMPI_THREAD_ADD32(&req->req_lock,-1); /* free the request if completed while in the scheduler */ if (req->req_send.req_base.req_free_called && req->req_send.req_base.req_pml_complete) { MCA_PML_UNIQ_FREE((ompi_request_t**)&req); } + return OMPI_SUCCESS; } + OMPI_THREAD_ADD32(&req->req_lock,-1); return OMPI_SUCCESS; }