Commit ee446c5c authored by Xin Zhao's avatar Xin Zhao
Browse files

Clean up white-space and code format in RMA code.

No reviewer.
parent dec3ed27
......@@ -12,7 +12,8 @@
#define FUNCNAME MPIDI_CH3_Win_shared_query
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_CH3_SHM_Win_shared_query(MPID_Win *win_ptr, int target_rank, MPI_Aint *size, int *disp_unit, void *baseptr)
int MPIDI_CH3_SHM_Win_shared_query(MPID_Win * win_ptr, int target_rank, MPI_Aint * size,
int *disp_unit, void *baseptr)
{
int comm_size;
int mpi_errno = MPI_SUCCESS;
......@@ -28,30 +29,31 @@ int MPIDI_CH3_SHM_Win_shared_query(MPID_Win *win_ptr, int target_rank, MPI_Aint
int i;
/* Default, if no processes have size > 0. */
*size = 0;
*disp_unit = 0;
*((void**) baseptr) = NULL;
*size = 0;
*disp_unit = 0;
*((void **) baseptr) = NULL;
for (i = 0; i < comm_size; i++) {
if (win_ptr->sizes[i] > 0) {
*size = win_ptr->sizes[i];
*disp_unit = win_ptr->disp_units[i];
*((void**) baseptr) = win_ptr->shm_base_addrs[i];
*size = win_ptr->sizes[i];
*disp_unit = win_ptr->disp_units[i];
*((void **) baseptr) = win_ptr->shm_base_addrs[i];
break;
}
}
} else {
*size = win_ptr->sizes[target_rank];
*disp_unit = win_ptr->disp_units[target_rank];
*((void**) baseptr) = win_ptr->shm_base_addrs[target_rank];
}
else {
*size = win_ptr->sizes[target_rank];
*disp_unit = win_ptr->disp_units[target_rank];
*((void **) baseptr) = win_ptr->shm_base_addrs[target_rank];
}
fn_exit:
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_CH3_WIN_SHARED_QUERY);
return mpi_errno;
fn_fail:
fn_fail:
goto fn_exit;
}
......@@ -60,7 +62,7 @@ fn_fail:
#define FUNCNAME MPIDI_CH3_SHM_Win_free
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_CH3_SHM_Win_free(MPID_Win **win_ptr)
int MPIDI_CH3_SHM_Win_free(MPID_Win ** win_ptr)
{
int mpi_errno = MPI_SUCCESS;
mpir_errflag_t errflag = MPIR_ERR_NONE;
......@@ -87,9 +89,12 @@ int MPIDI_CH3_SHM_Win_free(MPID_Win **win_ptr)
(*win_ptr)->create_flavor == MPI_WIN_FLAVOR_ALLOCATE) &&
(*win_ptr)->shm_segment_len > 0) {
/* detach from shared memory segment */
mpi_errno = MPIU_SHMW_Seg_detach((*win_ptr)->shm_segment_handle, (char **)&(*win_ptr)->shm_base_addr,
(*win_ptr)->shm_segment_len);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
mpi_errno =
MPIU_SHMW_Seg_detach((*win_ptr)->shm_segment_handle,
(char **) &(*win_ptr)->shm_base_addr,
(*win_ptr)->shm_segment_len);
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
MPIU_SHMW_Hnd_finalize(&(*win_ptr)->shm_segment_handle);
}
......@@ -104,9 +109,9 @@ int MPIDI_CH3_SHM_Win_free(MPID_Win **win_ptr)
MPID_Comm *node_comm_ptr = NULL;
/* When allocating shared memory region segment, we need comm of processes
that are on the same node as this process (node_comm).
If node_comm == NULL, this process is the only one on this node, therefore
we use comm_self as node comm. */
* that are on the same node as this process (node_comm).
* If node_comm == NULL, this process is the only one on this node, therefore
* we use comm_self as node comm. */
node_comm_ptr = (*win_ptr)->comm_ptr->node_comm;
MPIU_Assert(node_comm_ptr != NULL);
......@@ -115,9 +120,11 @@ int MPIDI_CH3_SHM_Win_free(MPID_Win **win_ptr)
}
/* detach from shared memory segment */
mpi_errno = MPIU_SHMW_Seg_detach((*win_ptr)->shm_mutex_segment_handle, (char **)&(*win_ptr)->shm_mutex,
sizeof(MPIDI_CH3I_SHM_MUTEX));
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
mpi_errno =
MPIU_SHMW_Seg_detach((*win_ptr)->shm_mutex_segment_handle,
(char **) &(*win_ptr)->shm_mutex, sizeof(MPIDI_CH3I_SHM_MUTEX));
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
MPIU_SHMW_Hnd_finalize(&(*win_ptr)->shm_mutex_segment_handle);
}
......@@ -129,12 +136,14 @@ int MPIDI_CH3_SHM_Win_free(MPID_Win **win_ptr)
}
mpi_errno = MPIDI_Win_free(win_ptr);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
fn_exit:
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_CH3_SHM_WIN_FREE);
return mpi_errno;
fn_fail:
fn_fail:
goto fn_exit;
}
......@@ -44,10 +44,10 @@ static inline int immed_copy(void *src, void *dest, size_t len)
MPIU_Memcpy(dest, (void *) src, len);
}
fn_exit:
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_IMMED_COPY);
return mpi_errno;
fn_fail:
fn_fail:
goto fn_exit;
}
......@@ -58,7 +58,7 @@ static inline int immed_copy(void *src, void *dest, size_t len)
#define FUNCNAME fill_in_derived_dtp_info
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int fill_in_derived_dtp_info(MPIDI_RMA_Op_t *rma_op, MPID_Datatype *dtp)
static int fill_in_derived_dtp_info(MPIDI_RMA_Op_t * rma_op, MPID_Datatype * dtp)
{
int mpi_errno = MPI_SUCCESS;
MPIU_CHKPMEM_DECL(1);
......@@ -82,19 +82,18 @@ static int fill_in_derived_dtp_info(MPIDI_RMA_Op_t *rma_op, MPID_Datatype *dtp)
rma_op->dtype_info.has_sticky_ub = dtp->has_sticky_ub;
rma_op->dtype_info.has_sticky_lb = dtp->has_sticky_lb;
MPIU_CHKPMEM_MALLOC(rma_op->dataloop, void *, dtp->dataloop_size,
mpi_errno, "dataloop");
MPIU_CHKPMEM_MALLOC(rma_op->dataloop, void *, dtp->dataloop_size, mpi_errno, "dataloop");
MPIU_Memcpy(rma_op->dataloop, dtp->dataloop, dtp->dataloop_size);
/* The dataloop can have undefined padding sections, so we need to let
* valgrind know that it is OK to pass this data to writev later on. */
MPL_VG_MAKE_MEM_DEFINED(rma_op->dataloop, dtp->dataloop_size);
fn_exit:
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_FILL_IN_DERIVED_DTP_INFO);
MPIU_CHKPMEM_COMMIT();
return mpi_errno;
fn_fail:
fn_fail:
MPIU_CHKPMEM_REAP();
goto fn_exit;
}
......@@ -146,8 +145,7 @@ static int create_datatype(const MPIDI_RMA_dtype_info * dtype_info,
ints[0] = count;
MPID_Datatype_get_ptr(combined_datatype, *combined_dtp);
mpi_errno = MPID_Datatype_set_contents(*combined_dtp, MPI_COMBINER_STRUCT,
count + 1, /* ints (cnt,blklen) */
mpi_errno = MPID_Datatype_set_contents(*combined_dtp, MPI_COMBINER_STRUCT, count + 1, /* ints (cnt,blklen) */
count, /* aints (disps) */
count, /* types */
ints, displaces, datatypes);
......@@ -185,7 +183,7 @@ static int create_datatype(const MPIDI_RMA_dtype_info * dtype_info,
#define FUNCNAME issue_from_origin_buffer
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int issue_from_origin_buffer(MPIDI_RMA_Op_t *rma_op, MPID_IOV *iov, MPIDI_VC_t *vc)
static int issue_from_origin_buffer(MPIDI_RMA_Op_t * rma_op, MPID_IOV * iov, MPIDI_VC_t * vc)
{
MPI_Aint origin_type_size;
MPI_Datatype target_datatype;
......@@ -202,7 +200,8 @@ static int issue_from_origin_buffer(MPIDI_RMA_Op_t *rma_op, MPID_IOV *iov, MPIDI
/* Fill derived datatype info. */
mpi_errno = fill_in_derived_dtp_info(rma_op, target_dtp);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
/* Set dataloop size in pkt header */
MPIDI_CH3_PKT_RMA_SET_DATALOOP_SIZE(rma_op->pkt, target_dtp->dataloop_size, mpi_errno);
......@@ -276,9 +275,9 @@ static int issue_from_origin_buffer(MPIDI_RMA_Op_t *rma_op, MPID_IOV *iov, MPIDI
mpi_errno = create_datatype(&rma_op->dtype_info, rma_op->dataloop,
target_dtp->dataloop_size,
rma_op->origin_addr, rma_op->origin_count,
rma_op->origin_datatype,
&combined_dtp);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
rma_op->origin_datatype, &combined_dtp);
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
rma_op->request->dev.datatype_ptr = combined_dtp;
/* combined_datatype will be freed when request is freed */
......@@ -302,10 +301,10 @@ static int issue_from_origin_buffer(MPIDI_RMA_Op_t *rma_op, MPID_IOV *iov, MPIDI
MPID_Datatype_release(target_dtp);
}
fn_exit:
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_ISSUE_FROM_ORIGIN_BUFFER);
return mpi_errno;
fn_fail:
fn_fail:
if (rma_op->request) {
if (rma_op->request->dev.datatype_ptr)
MPID_Datatype_release(rma_op->request->dev.datatype_ptr);
......@@ -321,9 +320,8 @@ static int issue_from_origin_buffer(MPIDI_RMA_Op_t *rma_op, MPID_IOV *iov, MPIDI
#define FUNCNAME issue_put_op
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int issue_put_op(MPIDI_RMA_Op_t * rma_op, MPID_Win *win_ptr,
MPIDI_RMA_Target_t *target_ptr,
MPIDI_CH3_Pkt_flags_t flags)
static int issue_put_op(MPIDI_RMA_Op_t * rma_op, MPID_Win * win_ptr,
MPIDI_RMA_Target_t * target_ptr, MPIDI_CH3_Pkt_flags_t flags)
{
MPIDI_VC_t *vc = NULL;
MPI_Aint origin_type_size;
......@@ -354,11 +352,12 @@ static int issue_put_op(MPIDI_RMA_Op_t * rma_op, MPID_Win *win_ptr,
/* We still need to issue from origin buffer. */
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) put_pkt;
iov[0].MPID_IOV_LEN = sizeof(*put_pkt);
iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) ((char *)rma_op->origin_addr);
iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) ((char *) rma_op->origin_addr);
iov[1].MPID_IOV_LEN = rma_op->origin_count * origin_type_size;
mpi_errno = issue_from_origin_buffer(rma_op, iov, vc);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
fn_exit:
......@@ -376,9 +375,8 @@ static int issue_put_op(MPIDI_RMA_Op_t * rma_op, MPID_Win *win_ptr,
#define FUNCNAME issue_acc_op
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int issue_acc_op(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
MPIDI_RMA_Target_t *target_ptr,
MPIDI_CH3_Pkt_flags_t flags)
static int issue_acc_op(MPIDI_RMA_Op_t * rma_op, MPID_Win * win_ptr,
MPIDI_RMA_Target_t * target_ptr, MPIDI_CH3_Pkt_flags_t flags)
{
MPIDI_VC_t *vc = NULL;
MPI_Aint origin_type_size;
......@@ -409,17 +407,18 @@ static int issue_acc_op(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
/* We still need to issue from origin buffer. */
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) accum_pkt;
iov[0].MPID_IOV_LEN = sizeof(*accum_pkt);
iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) ((char *)rma_op->origin_addr);
iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) ((char *) rma_op->origin_addr);
iov[1].MPID_IOV_LEN = rma_op->origin_count * origin_type_size;
mpi_errno = issue_from_origin_buffer(rma_op, iov, vc);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
fn_exit:
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_ISSUE_ACC_OP);
return mpi_errno;
fn_fail:
fn_fail:
goto fn_exit;
}
......@@ -429,9 +428,8 @@ static int issue_acc_op(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
#define FUNCNAME issue_get_acc_op
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int issue_get_acc_op(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
MPIDI_RMA_Target_t *target_ptr,
MPIDI_CH3_Pkt_flags_t flags)
static int issue_get_acc_op(MPIDI_RMA_Op_t * rma_op, MPID_Win * win_ptr,
MPIDI_RMA_Target_t * target_ptr, MPIDI_CH3_Pkt_flags_t flags)
{
MPIDI_VC_t *vc = NULL;
MPI_Aint origin_type_size;
......@@ -461,11 +459,11 @@ static int issue_get_acc_op(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
resp_req->dev.source_win_handle = win_ptr->handle;
if (!MPIR_DATATYPE_IS_PREDEFINED(resp_req->dev.datatype)) {
MPID_Datatype *result_dtp = NULL;
MPID_Datatype_get_ptr(resp_req->dev.datatype, result_dtp);
resp_req->dev.datatype_ptr = result_dtp;
/* this will cause the datatype to be freed when the
* request is freed. */
MPID_Datatype *result_dtp = NULL;
MPID_Datatype_get_ptr(resp_req->dev.datatype, result_dtp);
resp_req->dev.datatype_ptr = result_dtp;
/* this will cause the datatype to be freed when the
* request is freed. */
}
/* Note: Get_accumulate uses the same packet type as accumulate */
......@@ -480,7 +478,8 @@ static int issue_get_acc_op(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
if (rma_op->pkt.type == MPIDI_CH3_PKT_GET_ACCUM_IMMED) {
/* All origin data is in packet header, issue the header. */
MPIU_THREAD_CS_ENTER(CH3COMM, vc);
mpi_errno = MPIDI_CH3_iStartMsg(vc, get_accum_pkt, sizeof(*get_accum_pkt), &(rma_op->request));
mpi_errno =
MPIDI_CH3_iStartMsg(vc, get_accum_pkt, sizeof(*get_accum_pkt), &(rma_op->request));
MPIU_THREAD_CS_EXIT(CH3COMM, vc);
MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg");
}
......@@ -488,11 +487,12 @@ static int issue_get_acc_op(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
/* We still need to issue from origin buffer. */
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) get_accum_pkt;
iov[0].MPID_IOV_LEN = sizeof(*get_accum_pkt);
iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) ((char *)rma_op->origin_addr);
iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) ((char *) rma_op->origin_addr);
iov[1].MPID_IOV_LEN = rma_op->origin_count * origin_type_size;
mpi_errno = issue_from_origin_buffer(rma_op, iov, vc);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
/* This operation can generate two requests; one for inbound and one for
......@@ -524,11 +524,11 @@ static int issue_get_acc_op(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
/* For error checking */
resp_req = NULL;
fn_exit:
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_ISSUE_GET_ACC_OP);
return mpi_errno;
/* --BEGIN ERROR HANDLING-- */
fn_fail:
fn_fail:
if (resp_req != NULL) {
MPID_Request_release(resp_req);
}
......@@ -542,8 +542,7 @@ static int issue_get_acc_op(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int issue_get_op(MPIDI_RMA_Op_t * rma_op, MPID_Win * win_ptr,
MPIDI_RMA_Target_t *target_ptr,
MPIDI_CH3_Pkt_flags_t flags)
MPIDI_RMA_Target_t * target_ptr, MPIDI_CH3_Pkt_flags_t flags)
{
MPIDI_CH3_Pkt_get_t *get_pkt = &rma_op->pkt.get;
int mpi_errno = MPI_SUCCESS;
......@@ -600,7 +599,8 @@ static int issue_get_op(MPIDI_RMA_Op_t * rma_op, MPID_Win * win_ptr,
MPID_Datatype_get_ptr(target_datatype, dtp);
mpi_errno = fill_in_derived_dtp_info(rma_op, dtp);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
/* Set dataloop size in pkt header */
MPIDI_CH3_PKT_RMA_SET_DATALOOP_SIZE(rma_op->pkt, dtp->dataloop_size, mpi_errno);
......@@ -644,7 +644,7 @@ static int issue_get_op(MPIDI_RMA_Op_t * rma_op, MPID_Win * win_ptr,
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int issue_cas_op(MPIDI_RMA_Op_t * rma_op,
MPID_Win * win_ptr, MPIDI_RMA_Target_t *target_ptr,
MPID_Win * win_ptr, MPIDI_RMA_Target_t * target_ptr,
MPIDI_CH3_Pkt_flags_t flags)
{
MPIDI_VC_t *vc = NULL;
......@@ -707,7 +707,7 @@ static int issue_cas_op(MPIDI_RMA_Op_t * rma_op,
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int issue_fop_op(MPIDI_RMA_Op_t * rma_op,
MPID_Win * win_ptr, MPIDI_RMA_Target_t *target_ptr,
MPID_Win * win_ptr, MPIDI_RMA_Target_t * target_ptr,
MPIDI_CH3_Pkt_flags_t flags)
{
MPIDI_VC_t *vc = NULL;
......@@ -745,21 +745,22 @@ static int issue_fop_op(MPIDI_RMA_Op_t * rma_op,
MPID_Datatype_get_size_macro(rma_op->origin_datatype, origin_type_size);
if (rma_op->pkt.type == MPIDI_CH3_PKT_FOP_IMMED) {
/* All origin data is in packet header, issue the header. */
MPIU_THREAD_CS_ENTER(CH3COMM, vc);
mpi_errno = MPIDI_CH3_iStartMsg(vc, fop_pkt, sizeof(*fop_pkt), &(rma_op->request));
MPIU_THREAD_CS_EXIT(CH3COMM, vc);
MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg");
/* All origin data is in packet header, issue the header. */
MPIU_THREAD_CS_ENTER(CH3COMM, vc);
mpi_errno = MPIDI_CH3_iStartMsg(vc, fop_pkt, sizeof(*fop_pkt), &(rma_op->request));
MPIU_THREAD_CS_EXIT(CH3COMM, vc);
MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg");
}
else {
/* We still need to issue from origin buffer. */
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) fop_pkt;
iov[0].MPID_IOV_LEN = sizeof(*fop_pkt);
iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) ((char *)rma_op->origin_addr);
iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) ((char *) rma_op->origin_addr);
iov[1].MPID_IOV_LEN = origin_type_size;
mpi_errno = issue_from_origin_buffer(rma_op, iov, vc);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
/* This operation can generate two requests; one for inbound and one for
......@@ -790,11 +791,11 @@ static int issue_fop_op(MPIDI_RMA_Op_t * rma_op,
/* For error checking */
resp_req = NULL;
fn_exit:
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_ISSUE_FOP_OP);
return mpi_errno;
/* --BEGIN ERROR HANDLING-- */
fn_fail:
fn_fail:
if (resp_req != NULL) {
MPID_Request_release(resp_req);
}
......@@ -810,8 +811,7 @@ static int issue_fop_op(MPIDI_RMA_Op_t * rma_op,
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static inline int issue_rma_op(MPIDI_RMA_Op_t * op_ptr, MPID_Win * win_ptr,
MPIDI_RMA_Target_t * target_ptr,
MPIDI_CH3_Pkt_flags_t flags)
MPIDI_RMA_Target_t * target_ptr, MPIDI_CH3_Pkt_flags_t flags)
{
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_ISSUE_RMA_OP);
......@@ -857,4 +857,4 @@ static inline int issue_rma_op(MPIDI_RMA_Op_t * op_ptr, MPID_Win * win_ptr,
/* --END ERROR HANDLING-- */
}
#endif /* MPID_RMA_ISSUE_H_INCLUDED */
#endif /* MPID_RMA_ISSUE_H_INCLUDED */
......@@ -20,7 +20,7 @@ MPIR_T_PVAR_DOUBLE_TIMER_DECL_EXTERN(RMA, rma_winlock_getlocallock);
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static inline MPIDI_RMA_Lock_entry_t *MPIDI_CH3I_Win_lock_entry_alloc(MPID_Win * win_ptr,
MPIDI_CH3_Pkt_t *pkt)
MPIDI_CH3_Pkt_t * pkt)
{
MPIDI_RMA_Lock_entry_t *new_ptr = NULL;
......@@ -48,7 +48,7 @@ static inline MPIDI_RMA_Lock_entry_t *MPIDI_CH3I_Win_lock_entry_alloc(MPID_Win *
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static inline int MPIDI_CH3I_Win_lock_entry_free(MPID_Win * win_ptr,
MPIDI_RMA_Lock_entry_t *lock_entry)
MPIDI_RMA_Lock_entry_t * lock_entry)
{
int mpi_errno = MPI_SUCCESS;
......@@ -58,10 +58,10 @@ static inline int MPIDI_CH3I_Win_lock_entry_free(MPID_Win * win_ptr,
}
/* use PREPEND when return objects back to the pool
in order to improve cache performance */
* in order to improve cache performance */
MPL_LL_PREPEND(win_ptr->lock_entry_pool, win_ptr->lock_entry_pool_tail, lock_entry);
return mpi_errno;
}
#endif /* MPID_RMA_ISSUE_H_INCLUDED */
#endif /* MPID_RMA_ISSUE_H_INCLUDED */
......@@ -17,7 +17,8 @@ int MPIDI_CH3I_RMA_Make_progress_target(MPID_Win * win_ptr, int target_rank, int
int MPIDI_CH3I_RMA_Make_progress_win(MPID_Win * win_ptr, int *made_progress);
extern MPIDI_RMA_Op_t *global_rma_op_pool, *global_rma_op_pool_tail, *global_rma_op_pool_start;
extern MPIDI_RMA_Target_t *global_rma_target_pool, *global_rma_target_pool_tail, *global_rma_target_pool_start;
extern MPIDI_RMA_Target_t *global_rma_target_pool, *global_rma_target_pool_tail,
*global_rma_target_pool_start;
MPIR_T_PVAR_DOUBLE_TIMER_DECL_EXTERN(RMA, rma_rmaqueue_alloc);
......@@ -72,7 +73,7 @@ static inline int MPIDI_CH3I_Win_op_free(MPID_Win * win_ptr, MPIDI_RMA_Op_t * e)
* at window free time, they won't conflict with the global pool
* or other windows */
/* use PREPEND when return objects back to the pool
in order to improve cache performance */
* in order to improve cache performance */
if (e->pool_type == MPIDI_RMA_POOL_WIN)
MPL_LL_PREPEND(win_ptr->op_pool, win_ptr->op_pool_tail, e);
else
......@@ -122,9 +123,9 @@ static inline MPIDI_RMA_Target_t *MPIDI_CH3I_Win_target_alloc(MPID_Win * win_ptr
e->sync.sync_flag = MPIDI_RMA_SYNC_NONE;
e->sync.outstanding_acks = 0;
e->sync.have_remote_incomplete_ops = 1; /* When I create a new target, there must be
incomplete ops until a FLUSH/UNLOCK packet
is sent. */
e->sync.have_remote_incomplete_ops = 1; /* When I create a new target, there must be
* incomplete ops until a FLUSH/UNLOCK packet
* is sent. */
return e;
}
......@@ -147,7 +148,7 @@ static inline int MPIDI_CH3I_Win_target_free(MPID_Win * win_ptr, MPIDI_RMA_Targe
MPIU_Assert(e->pending_op_list == NULL);
/* use PREPEND when return objects back to the pool
in order to improve cache performance */
* in order to improve cache performance */
if (e->pool_type == MPIDI_RMA_POOL_WIN)
MPL_LL_PREPEND(win_ptr->target_pool, win_ptr->target_pool_tail, e);
else
......@@ -163,7 +164,7 @@ static inline int MPIDI_CH3I_Win_target_free(MPID_Win * win_ptr, MPIDI_RMA_Targe
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static inline int MPIDI_CH3I_Win_create_target(MPID_Win * win_ptr, int target_rank,
MPIDI_RMA_Target_t **e)
MPIDI_RMA_Target_t ** e)
{
int mpi_errno = MPI_SUCCESS;
MPIDI_RMA_Slot_t *slot = NULL;
......@@ -177,7 +178,8 @@ static inline int MPIDI_CH3I_Win_create_target(MPID_Win * win_ptr, int target_ra
t = MPIDI_CH3I_Win_target_alloc(win_ptr);
if (t == NULL) {
mpi_errno = MPIDI_CH3I_RMA_Cleanup_target_aggressive(win_ptr, &t);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
t->target_rank = target_rank;
......@@ -192,9 +194,9 @@ static inline int MPIDI_CH3I_Win_create_target(MPID_Win * win_ptr, int target_ra
(*e) = t;
fn_exit:
fn_exit:
return mpi_errno;
fn_fail:
fn_fail:
goto fn_exit;
}
......@@ -205,7 +207,7 @@ static inline int MPIDI_CH3I_Win_create_target(MPID_Win * win_ptr, int target_ra
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static inline int MPIDI_CH3I_Win_find_target(MPID_Win * win_ptr, int target_rank,
MPIDI_RMA_Target_t **e)
MPIDI_RMA_Target_t ** e)
{
int mpi_errno = MPI_SUCCESS;
MPIDI_RMA_Slot_t *slot = NULL;
......@@ -224,9 +226,9 @@ static inline int MPIDI_CH3I_Win_find_target(MPID_Win * win_ptr, int target_rank
(*e) = t;
fn_exit:
fn_exit:
return mpi_errno;
fn_fail:
fn_fail:
goto fn_exit;
}
......@@ -237,17 +239,18 @@ static inline int MPIDI_CH3I_Win_find_target(MPID_Win * win_ptr, int target_rank
#define FUNCNAME MPIDI_CH3I_Win_enqueue_op
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static inline int MPIDI_CH3I_Win_enqueue_op(MPID_Win * win_ptr,
MPIDI_RMA_Op_t * op)
static inline int MPIDI_CH3I_Win_enqueue_op(MPID_Win * win_ptr, MPIDI_RMA_Op_t * op)
{
int mpi_errno = MPI_SUCCESS;
MPIDI_RMA_Target_t *target = NULL;
mpi_errno = MPIDI_CH3I_Win_find_target(win_ptr, op->target_rank, &target);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
if (target == NULL) {
mpi_errno = MPIDI_CH3I_Win_create_target(win_ptr, op->target_rank, &target);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
if (win_ptr->states.access_state == MPIDI_RMA_PER_TARGET ||
win_ptr->states.access_state == MPIDI_RMA_LOCK_ALL_GRANTED) {
......@@ -263,8 +266,8 @@ static inline int MPIDI_CH3I_Win_enqueue_op(MPID_Win * win_ptr,
}
else if (win_ptr->states.access_state == MPIDI_RMA_LOCK_ALL_CALLED) {
/* If global state is MPIDI_RMA_LOCK_ALL_CALLED, this must
the first time to create this target, set its access state
to MPIDI_RMA_LOCK_CALLED. */
* the first time to create this target, set its access state
* to MPIDI_RMA_LOCK_CALLED. */
target->access_state = MPIDI_RMA_LOCK_CALLED;
target->lock_type = MPI_LOCK_SHARED;
}
......@@ -279,9 +282,9 @@ static inline int MPIDI_CH3I_Win_enqueue_op(MPID_Win * win_ptr,
target->accumulated_ops_cnt++;
win_ptr->accumulated_ops_cnt++;
fn_exit:
fn_exit:
return mpi_errno;
fn_fail:
fn_fail:
goto fn_exit;
}
......@@ -292,8 +295,7 @@ static inline int MPIDI_CH3I_Win_enqueue_op(MPID_Win * win_ptr,
#define FUNCNAME MPIDI_CH3I_Win_target_dequeue_and_free
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static inline int MPIDI_CH3I_Win_target_dequeue_and_free(MPID_Win * win_ptr,
MPIDI_RMA_Target_t * e)
static inline int MPIDI_CH3I_Win_target_dequeue_and_free(MPID_Win * win_