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

Keep track of no. of non-empty slots on window.



Keep track of no. of non-empty slots on window so that
when number is 0, there are no operations needed to
be processed and we can ignore that window.
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@anl.gov>
parent f076f3fe
......@@ -167,6 +167,9 @@ static inline int MPIDI_CH3I_Win_create_target(MPID_Win * win_ptr, int target_ra
t->target_rank = target_rank;
if (slot->target_list == NULL)
win_ptr->non_empty_slots++;
/* Enqueue target into target list. */
MPL_LL_APPEND(slot->target_list, slot->target_list_tail, t);
......@@ -287,6 +290,9 @@ static inline int MPIDI_CH3I_Win_target_dequeue_and_free(MPID_Win * win_ptr,
mpi_errno = MPIDI_CH3I_Win_target_free(win_ptr, e);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
if (slot->target_list == NULL)
win_ptr->non_empty_slots--;
fn_exit:
return mpi_errno;
fn_fail:
......
......@@ -367,6 +367,7 @@ struct MPIDI_Win_target_state {
enum MPIDI_RMA_states access_state; \
enum MPIDI_RMA_states exposure_state; \
} states; \
int non_empty_slots; \
#ifdef MPIDI_CH3_WIN_DECL
#define MPID_DEV_WIN_DECL \
......
......@@ -331,6 +331,7 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
(*win_ptr)->shm_allocated = FALSE;
(*win_ptr)->states.access_state = MPIDI_RMA_NONE;
(*win_ptr)->states.exposure_state = MPIDI_RMA_NONE;
(*win_ptr)->non_empty_slots = 0;
/* Initialize the passive target lock state */
MPIU_CHKPMEM_MALLOC((*win_ptr)->targets, struct MPIDI_Win_target_state *,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment